common package#

Submodules#

common.Browser module#

class common.Browser.Browser(parent=None, help_mapping={}, base_path='')[source]#

Bases: QDockWidget

A collection of browser related methods.

Parameters:
  • parent (QMainWindow) – Calling UI

  • help_mapping (dict) – Dictionary with objects as keys and page (excluding html) for navigation

  • base_path (str) – Base directory to docs/build/html.

eventFilter :

event filter used to select help page.

open_browser :

Opens a web browser for use in LaME

go_to_home :

Returns to project homepage.

go_to_page :

Loads location typed into the file line edit field.

Raises:

TypeError : – Parent must be an instance of QMainWindow

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

allowedAreas(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, event)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(obj, event)

Event filter to capture mouse press and hover events

features(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

go_to_home()

The browser returns to the documentation index.html file

go_to_page([location])

Tries to load the page given in MainWindow.browser_location

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAreaAllowed(self, area)

isEnabled(self)

isEnabledTo(self, a0)

isFloating(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

open_browser()

Creates and opens a browser in the bottom tabWidget

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, event)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllowedAreas(self, areas)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFeatures(self, features)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFloating(self, floating)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTitleBarWidget(self, widget)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWidget(self, widget)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

titleBarWidget(self)

toggleViewAction(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockWidgetFeature

PaintDeviceMetric

RenderFlag

allowedAreasChanged

customContextMenuRequested

destroyed

dockLocationChanged

featuresChanged

objectNameChanged

topLevelChanged

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

eventFilter(obj, event)[source]#

Event filter to capture mouse press and hover events

If help mode is active, handles mouse clicks to open help or changes cursor on hover.

Parameters:
  • obj (QObject) – The widget the event occurred on.

  • event (QEvent) – The event being filtered.

Returns:

True if the event was handled, otherwise False.

Return type:

bool

go_to_home()[source]#

The browser returns to the documentation index.html file

go_to_page(location=None)[source]#

Tries to load the page given in MainWindow.browser_location

Parameters:

location (str, optional) – Name of webpage (excluding base directory and .html)

open_browser()[source]#

Creates and opens a browser in the bottom tabWidget

A browser for the LaME documentation. It can access some external sites, but the browser is primarily for help data.

class common.Browser.WebEngineView(parent=None)[source]#

Bases: QWebEngineView

Creates a web engine widget to display user guide

_extended_summary_

Parameters:

QWebEngineView (QWebEngine) – A web engine widget

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

back(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createStandardContextMenu(self)

createWindow(self, type)

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, e)

dragLeaveEvent(self, e)

dragMoveEvent(self, e)

dropEvent(self, e)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

findText(self, subString[, options, ...])

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

forPage(page)

foregroundRole(self)

forward(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasSelection(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

history(self)

icon(self)

iconUrl(self)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

lastContextMenuRequest(self)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

load(load)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

on_load_finished(success)

Executes after page loading is complete

on_load_progress(progress)

Adds a loading progress message to the MainWindow.statusBar

on_load_started()

Executes when page starts to load.

overrideWindowFlags(self, type)

overrideWindowState(self, state)

page(self)

pageAction(self, action)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

print(self, printer)

printToPdf(, QPageLayout.Portrait, ...)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

reload(self)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

selectedText(self)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContent(self, data[, mimeType, baseUrl])

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setHtml(self, html[, baseUrl])

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPage(self, page)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setUrl(self, url)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

setZoomFactor(self, factor)

settings(self)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

show_error_page()

Displays 404 error page.

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

stop(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

title(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

triggerPageAction(self, action[, checked])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

url(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

zoomFactor(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

handle_console_message

iconChanged

iconUrlChanged

loadFinished

loadProgress

loadStarted

objectNameChanged

pdfPrintingFinished

printFinished

printRequested

printRequestedByFrame

renderProcessTerminated

selectionChanged

titleChanged

urlChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

handle_console_message(level, message, line, source_id)[source]#
on_load_finished(success)[source]#

Executes after page loading is complete

Parameters:

success (bool) – Runs upon load

on_load_progress(progress)[source]#

Adds a loading progress message to the MainWindow.statusBar

Parameters:

progress (int) – Loading fraction

on_load_started()[source]#

Executes when page starts to load.

show_error_page()[source]#

Displays 404 error page.

common.Calculator module#

class common.Calculator.CalculatorDock(ui=None, filename=None)[source]#

Bases: CustomDockWidget, FieldLogicUI

Creates a CustomFieldCalculator with UI controls inside a dock widget that can be added to a QMainWindow

Parameters:
  • parent (QMainWindow, optional) – _description_, by default None

  • filename (str, optional) – Filename for saving calculator functions, by default None

  • debug (bool, optional) – When True, will create verbose output, by default False

Returns:

_description_

Return type:

_type_

Raises:

TypeError – Parent must be an instance of QMainWindow.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

allowedAreas(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

calc_add_field()

Adds the selected field to the calculator

calc_delete_formula()

Deletes a previously stored formula

calc_help()

Loads the help webpage associated with the calculator in the Help tab

calc_insert_function(func_name)

Inserts a func_name into the calculator

calc_insert_operator(operator)

Inserts an operator into the calculator

calc_load_dict()

Loads saved calculated fields

calc_load_formula()

Loads a predefined formula to use in the calculator

calc_set_add_formula()

Sets whether to add a new function

calculate_new_field([save])

Calculates a new field from CalculatorDock.calc_text_edit and updates UI

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Override the default close event to hide the dock widget instead of closing it.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

features(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAreaAllowed(self, area)

isEnabled(self)

isEnabledTo(self, a0)

isFloating(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, event)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllowedAreas(self, areas)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFeatures(self, features)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFloating(self, floating)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTitleBarWidget(self, widget)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWidget(self, widget)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

titleBarWidget(self)

toggleViewAction(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_data(data)

Updates the data

update_field_combobox(parentBox, childBox, ...)

Updates comboBoxes with fields for plots or analysis

update_field_type_combobox(comboBox[, ...])

Updates field type combobox

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockWidgetFeature

PaintDeviceMetric

RenderFlag

allowedAreasChanged

connect_logger

connect_widgets

customContextMenuRequested

destroyed

dockLocationChanged

featuresChanged

objectNameChanged

setupUI

topLevelChanged

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

calc_add_field()[source]#

Adds the selected field to the calculator

Adds the selected field as {field_type.field}. If the field is normalized, a _N is added to the end of the field name, i.e., {field_type.field_N}.

calc_delete_formula()[source]#

Deletes a previously stored formula

Removes the formula from MainWindow.formula_combobox, the file given by MainWindow.calc_filename and parent.app_data.data[parent.app_data.sample_id].processed.

calc_help()[source]#

Loads the help webpage associated with the calculator in the Help tab

calc_insert_function(func_name)[source]#

Inserts a func_name into the calculator

When the user pushes a function button on the calculator, operator is inserted into MainWindow.calc_text_edit. The case() function inserts (cond, expr) as both a condition and expression are required to compute.

Parameters:

operator (str) – Inserts operators from calculator

calc_insert_operator(operator)[source]#

Inserts an operator into the calculator

When the user pushes an operator button on the calculator, operator is inserted into MainWindow.calc_text_edit.

Parameters:

operator (str) – Inserts operators from calculator

calc_load_dict()[source]#

Loads saved calculated fields

Loads the file saved in self.calc_filename, unless the file is overridden by user preferences. The file should be formatted as name: expression. The expression may contain mulitple case(cond, expr) separated by a ;.

calc_load_formula()[source]#

Loads a predefined formula to use in the calculator

calc_set_add_formula()[source]#

Sets whether to add a new function

Sets MainWindow.add_formula to True, a flag used by MainWindow.calculate_new_field to determine whether to add an item to MainWindow.formula_combobox.

calculate_new_field(save=False)[source]#

Calculates a new field from CalculatorDock.calc_text_edit and updates UI

When CalculatorDock.toolButtonCalculate is clicked, …

If save == True, the formula to resources/app_data/calculator.txt file so it can be recalled and used at a future time or in another sample. Pushing CalculatorDock.toolButtonCalcSave, opens a dialog prompting the user to input the name for the newly calculated field.

Parameters:
  • data (AttributeDataFrame) – Data used to compute custom field

  • save (bool, optional) – Determines whether to save upon successful calculation, by default False

closeEvent(event)#

Override the default close event to hide the dock widget instead of closing it.

This prevents the widget from being destroyed and allows it to be shown again later via widget.show().

Parameters:

event (QEvent) – The close event triggered by the user action.

connect_logger()[source]#
connect_widgets()[source]#
setupUI()[source]#
update_data(data)#

Updates the data

Parameters:

data (AttributeDataFrame) – New data frame

update_field_combobox(parentBox, childBox, *args, **kwargs)#

Updates comboBoxes with fields for plots or analysis

Updates lists of fields in comboBoxes that are used to generate plots or used for analysis. Calls MainWindow.get_field_list() to construct the list.

Parameters:
  • parentBox (QComboBox, None) – ComboBox used to select field type (‘Analyte’, ‘Analyte (normalized)’, ‘Ratio’, etc.), if None, then ‘Analyte’

  • childBox (QComboBox) – ComboBox with list of field values

update_field_type_combobox(comboBox, addNone=False, plot_type='')#

Updates field type combobox

Used to update MainWindow.comboBoxHistFieldType, MainWindow.comboBoxFilterFieldType, MainWindow.comboBoxFieldTypeX, MainWindow.comboBoxFieldTypeY, MainWindow.comboBoxFieldTypeZ, and MainWindow.comboBoxColorByField

Parameters:
  • combobox (QComboBox) – The combobox to update.

  • addNone (bool) – Adds None to the top of the combobox list

  • plot_type (str) – The plot type helps to define the set of field types available, by default '' (no change)

class common.Calculator.CustomFieldCalculator[source]#

Bases: object

Methods

calc_evaluate_expr(expr[, val_dict, keep])

Evaluates an expression and returns the result

calc_parse(data, ref_chem[, txt])

Prepares expression for calculating a custom field

calculate_new_field(data, ref_chem, new_field)

Calculates a new field from MainWindow.calc_text_edit

calc_evaluate_expr(expr, val_dict=None, keep=None)[source]#

Evaluates an expression and returns the result

Parameters:
  • expr (string) – Expression to be evaluated. The expression can be a conditional expression, which results in returning a np.ndarray of bool, otherwise, generally np.ndarray of float

  • val_dict (dict) – Dictionary with variable names as the key and values taken from the data, generally np.ndarray, by default None

  • keep (np.ndarray of bool or None, optional) – An array of True/False values that are used to evaluate the expression of limited values, i.e., generally when cases are involved.

Returns:

Result of evaluated expression.

Return type:

np.ndarray of float or bool

calc_parse(data, ref_chem, txt=None)[source]#

Prepares expression for calculating a custom field

Parses MainWindow.calc_text_edit to produce an expression that can be evaluated.

Parameters:
Returns:

returns the conditional (cond) and expression (expr)

Return type:

str, str

calculate_new_field(data, ref_chem, new_field)[source]#

Calculates a new field from MainWindow.calc_text_edit

When MainWindow.toolButtonCalculate is clicked, …

If save == True, the formula to resources/app_data/calculator.txt file so it can be recalled and used at a future time or in another sample. Pushing MainWindow.toolButtonCalcSave, opens a dialog prompting the user to input the name for the newly calculated field.

Parameters:
  • data (AttributeDataFrame) – Data used to compute custom field

  • new_field (str) – Name of new field to be computed

common.Calculator.calc_error(parent, func, err, addinfo)[source]#

Raise a calculator-related error

Parameters:
  • func (str) – Function that threw the error

  • err (str) – Error string

  • addinfo (str) – Additional info (generally exception raised)

common.CodingWidgets module#

class common.CodingWidgets.CodeEditor(parent=None)[source]#

Bases: QPlainTextEdit

Attributes:
highlight_line

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addScrollBarWidget(self, widget, alignment)

adjustSize(self)

anchorAt(self, pos)

appendHtml(self, html)

appendPlainText(self, text)

autoFillBackground(self)

backgroundRole(self)

backgroundVisible(self)

baseSize(self)

blockBoundingGeometry(self, block)

blockBoundingRect(self, block)

blockCount(self)

blockSignals(self, b)

canInsertFromMimeData(self, source)

canPaste(self)

centerCursor(self)

centerOnScroll(self)

changeEvent(self, e)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clear(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentOffset(self)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, e)

contextMenuPolicy(self)

copy(self)

cornerWidget(self)

create(self[, window, initializeWindow, ...])

createMimeDataFromSelection(self)

createStandardContextMenu(-> Optional[QMenu])

createWindowContainer(window[, parent, flags])

currentCharFormat(self)

cursor(self)

cursorForPosition(self, pos)

cursorRect(-> QRect)

cursorWidth(self)

customEvent(self, a0)

cut(self)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

document(self)

documentTitle(self)

dragEnterEvent(self, e)

dragLeaveEvent(self, e)

dragMoveEvent(self, e)

drawFrame(self, a0)

dropEvent(self, e)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensureCursorVisible(self)

ensurePolished(self)

enterEvent(self, event)

event(self, e)

eventFilter(self, a0, a1)

extraSelections(self)

find() -> bool ))

findChild(-> QObjectT)

findChildren(...)

firstVisibleBlock(self)

focusInEvent(self, e)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, e)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameRect(self)

frameShadow(self)

frameShape(self)

frameSize(self)

frameStyle(self)

frameWidth(self)

geometry(self)

getPaintContext(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

horizontalScrollBar(self)

horizontalScrollBarPolicy(self)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(-> Any)

insertAction(self, before, action)

insertActions(self, before, actions)

insertFromMimeData(self, source)

insertPlainText(self, text)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isReadOnly(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isUndoRedoEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, e)

keyReleaseEvent(self, e)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

lineWidth(self)

lineWrapMode(self)

loadResource(self, type, name)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumBlockCount(self)

maximumHeight(self)

maximumSize(self)

maximumViewportSize(self)

maximumWidth(self)

mergeCurrentCharFormat(self, modifier)

metaObject(self)

metric(self, a0)

midLineWidth(self)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, e)

mouseGrabber()

mouseMoveEvent(self, e)

mousePressEvent(self, e)

mouseReleaseEvent(self, e)

move(move)

moveCursor(self, operation[, mode])

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

overwriteMode(self)

paintEngine(self)

paintEvent(self, e)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

paste(self)

physicalDpiX(self)

physicalDpiY(self)

placeholderText(self)

pos(self)

previousInFocusChain(self)

print(self, printer)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

redo(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, e)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

scrollBarWidgets(self, alignment)

scrollContentsBy(self, dx, dy)

selectAll(self)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBackgroundVisible(self, visible)

setBaseSize(setBaseSize)

setCenterOnScroll(self, enabled)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCornerWidget(self, widget)

setCurrentCharFormat(self, format)

setCursor(self, a0)

setCursorWidth(self, width)

setDisabled(self, a0)

setDocument(self, document)

setDocumentTitle(self, title)

setEnabled(self, a0)

setExtraSelections(self, selections)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrameRect(self, a0)

setFrameShadow(self, a0)

setFrameShape(self, a0)

setFrameStyle(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setHorizontalScrollBar(self, scrollbar)

setHorizontalScrollBarPolicy(self, a0)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLineWidth(self, a0)

setLineWrapMode(self, mode)

setLocale(self, locale)

setMask(setMask)

setMaximumBlockCount(self, maximum)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMidLineWidth(self, a0)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setOverwriteMode(self, overwrite)

setPalette(self, a0)

setParent(setParent)

setPlaceholderText(self, placeholderText)

setPlainText(self, text)

setProperty(self, name, value)

setReadOnly(self, ro)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeAdjustPolicy(self, policy)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabChangesFocus(self, b)

setTabOrder(a0, a1)

setTabStopDistance(self, distance)

setTabletTracking(self, enable)

setTextCursor(self, cursor)

setTextInteractionFlags(self, flags)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUndoRedoEnabled(self, enable)

setUpdatesEnabled(self, enable)

setVerticalScrollBar(self, scrollbar)

setVerticalScrollBarPolicy(self, a0)

setViewport(self, widget)

setViewportMargins(setViewportMargins)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

setWordWrapMode(self, policy)

setupViewport(self, viewport)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeAdjustPolicy(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabChangesFocus(self)

tabStopDistance(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

textCursor(self)

textInteractionFlags(self)

thread(self)

timerEvent(self, e)

toPlainText(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

undo(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

verticalScrollBar(self)

verticalScrollBarPolicy(self)

viewport(self)

viewportEvent(self, a0)

viewportMargins(self)

viewportSizeHint(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, e)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

wordWrapMode(self)

x(self)

y(self)

zoomIn(self[, range])

zoomOut(self[, range])

LineWrapMode

PaintDeviceMetric

RenderFlag

Shadow

Shape

SizeAdjustPolicy

StyleMask

blockCountChanged

copyAvailable

cursorPositionChanged

customContextMenuRequested

destroyed

highlightCurrentLine

lineNumberAreaPaintEvent

lineNumberAreaWidth

load_all_settings

modificationChanged

objectNameChanged

open_highlight_dialog

open_settings_dialog

redoAvailable

repeat_heading_char

save_all_settings

selectionChanged

setHighlighter

textChanged

toggle_highlighter

undoAvailable

updateLineNumberArea

updateLineNumberAreaWidth

updateRequest

update_font

update_font_size

windowIconChanged

windowIconTextChanged

windowTitleChanged

highlightCurrentLine()[source]#
property highlight_line#
keyPressEvent(self, e: QKeyEvent | None)[source]#
lineNumberAreaPaintEvent(event)[source]#
lineNumberAreaWidth()[source]#
load_all_settings()[source]#
mouseMoveEvent(self, e: QMouseEvent | None)[source]#
open_highlight_dialog()[source]#
open_settings_dialog()[source]#
repeat_heading_char(char)[source]#
resizeEvent(self, e: QResizeEvent | None)[source]#
save_all_settings()[source]#
setHighlighter(highlighter)[source]#
toggle_highlighter(enable)[source]#
updateLineNumberArea(rect, dy)[source]#
updateLineNumberAreaWidth(_)[source]#
update_font(new_family)[source]#
update_font_size(new_size)[source]#
class common.CodingWidgets.CodeEditorMenu(editor: CodeEditor, menu_bar: QMenuBar)[source]#

Bases: object

class common.CodingWidgets.CodeEditorToolbar(editor: CodeEditor, toolbar: QToolBar)[source]#

Bases: object

class common.CodingWidgets.EditorSettingsDialog(settings, default_settings, editor=None)[source]#

Bases: QDialog

Methods

accept(self)

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

done(self, a0)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

exec(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isSizeGripEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

open(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

reject(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

result(self)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModal(self, modal)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setResult(self, r)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeGripEnabled(self, a0)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DialogCode

PaintDeviceMetric

RenderFlag

accepted

customContextMenuRequested

destroyed

finished

objectNameChanged

rejected

windowIconChanged

windowIconTextChanged

windowTitleChanged

class common.CodingWidgets.HighlightRulesDialog(rules, parent=None)[source]#

Bases: QDialog

Methods

accept(self)

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

done(self, a0)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

exec(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isSizeGripEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

open(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

reject(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

result(self)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModal(self, modal)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setResult(self, r)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeGripEnabled(self, a0)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DialogCode

PaintDeviceMetric

RenderFlag

accepted

choose_bg_color

choose_color

choose_text_color

customContextMenuRequested

destroyed

finished

load_rule

objectNameChanged

open_highlight_dialog

rejected

save_rule

windowIconChanged

windowIconTextChanged

windowTitleChanged

choose_bg_color()[source]#
choose_color()[source]#
choose_text_color()[source]#
load_rule(index)[source]#
open_highlight_dialog()[source]#
save_rule()[source]#
class common.CodingWidgets.LineNumberArea(editor)[source]#

Bases: QWidget

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

paintEvent(self, a0: QPaintEvent | None)[source]#
sizeHint(self) QSize[source]#
class common.CodingWidgets.RstBlockData[source]#

Bases: QTextBlockUserData

class common.CodingWidgets.RstHighlighter(editor, enable, rules=None)[source]#

Bases: QSyntaxHighlighter

Methods

blockSignals(self, b)

childEvent(self, a0)

children(self)

connectNotify(self, signal)

currentBlock(self)

currentBlockState(self)

currentBlockUserData(self)

customEvent(self, a0)

deleteLater(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

document(self)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, a0)

eventFilter(self, a0, a1)

findChild(-> QObjectT)

findChildren(...)

format(self, pos)

highlightBlock(self, text)

inherits(self, classname)

installEventFilter(self, a0)

isQuickItemType(self)

isSignalConnected(self, signal)

isWidgetType(self)

isWindowType(self)

killTimer(self, id)

metaObject(self)

moveToThread(self, thread)

objectName(self)

parent(self)

previousBlockState(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, signal)

rehighlight(self)

rehighlightBlock(self, block)

removeEventFilter(self, a0)

sender(self)

senderSignalIndex(self)

setCurrentBlockState(self, newState)

setCurrentBlockUserData(self, data)

setDocument(self, doc)

setFormat(setFormat setFormat  -> None)

setObjectName(self, name)

setParent(self, a0)

setProperty(self, name, value)

signalsBlocked(self)

startTimer(self, interval[, timerType])

thread(self)

timerEvent(self, a0)

tr(sourceText[, disambiguation, n])

validate_match(fmt_name, matched_text, ...)

Determine whether a match is invalid based on formatting and block context.

destroyed

objectNameChanged

open_highlight_dialog

highlightBlock(self, text: str | None)[source]#
open_highlight_dialog()[source]#
validate_match(fmt_name: str, matched_text: str, block_data: RstBlockData)[source]#

Determine whether a match is invalid based on formatting and block context.

Parameters:
  • fmt_name (str) – Name of formatting rule that will be checked for syntax accuracy

  • matched_text (str) – The matched text fitting the regex pattern on the current line

  • block_data (RstBlockData) – The current block data

Returns:

  • invalid (bool) – Flag indicating valid (False) or invalid (True) syntax

  • hover_text (str) – Text to display if syntax check is invalid

common.CodingWidgets.default_font()[source]#
common.CodingWidgets.load_highlight_rules(filepath)[source]#

Load highlighting rules.

Parameters:

filepath (path) – _description_

Returns:

Highlight rules

Return type:

dict

Example

from pathlib import Path

config_path = Path.home() / ".myapp" / "highlight_rules.json"
config_path.parent.mkdir(parents=True, exist_ok=True)
save_highlight_rules(AYU_RST_HIGHLIGHT_RULES, config_path)
common.CodingWidgets.save_highlight_rules(rules, filepath)[source]#

_summary_

_extended_summary_

Parameters:
  • rules (_type_) – _description_

  • filepath (_type_) – _description_

Example

highlight_rules = load_highlight_rules("highlight_rules.json")

common.ColorManager module#

Color Manager Handles conversions between different color systems.

Created on Sat Aug 16 2025

@author: Derrick Hasterok

class common.ColorManager.ColorConverter[source]#

Bases: object

Unified color conversion system with explicit format specification.

SUPPORTED_FORMATS = {'cmyk', 'hex', 'hsl', 'hsv', 'qcolor', 'rgb'}#
common.ColorManager.convert_color(color: Any, input_format: str, output_format: str, norm_in: bool = True, norm_out: bool = True, include_alpha: bool = None, uppercase: bool = True) Any[source]#

Convert color between different formats with explicit format specification.

Parameters:
  • color (Any) – Input color in the specified input format

  • input_format (str) – Input format: ‘rgb’, ‘hsv’, ‘hsl’, ‘cmyk’, ‘hex’, ‘qcolor’

  • output_format (str) – Output format: ‘rgb’, ‘hsv’, ‘hsl’, ‘cmyk’, ‘hex’, ‘qcolor’

  • norm_in (bool, default True) – Whether input values are normalized (0-1) or not (0-255 for RGB, 0-360/0-100 for HSV/HSL, etc.)

  • norm_out (bool, default True) – Whether to return normalized (0-1) or denormalized values

  • include_alpha (bool, optional) – Whether to include alpha channel. If None, auto-detect based on input

  • uppercase (bool, default True) – For hex output, whether to use uppercase letters

Returns:

Converted color in the specified output format, or None if conversion fails

Return type:

Any

Examples

>>> convert_color([255, 0, 0], 'rgb', 'hex', norm_in=False)
'#FF0000'
>>> convert_color('#FF0000', 'hex', 'hsv', norm_out=False)
(0.0, 100.0, 100.0)
>>> convert_color(np.array([1.0, 0.0, 0.0]), 'rgb', 'hsl')
(0.0, 1.0, 0.5)
>>> convert_color([360, 100, 50], 'hsv', 'rgb', norm_in=False, norm_out=False)
(128, 0, 128)
common.ColorManager.convert_color_list(colors: List[Any], input_format: str, output_format: str, **kwargs) List[Any][source]#

Convert a list of colors between formats.

Parameters:
  • colors (List[Any]) – List of input colors

  • input_format (str) – Input format for all colors

  • output_format (str) – Output format for all colors

  • **kwargs – Additional arguments passed to convert_color

Returns:

List of converted colors (failed conversions are omitted)

Return type:

List[Any]

common.ColormapEditor module#

Custom Colormap Editor

Created on Sat Aug 16 2025

@author: Derrick Hasterok

class common.ColormapEditor.AddColorPoint(model, position, color, index=None)[source]#

Bases: QUndoCommand

Undo/redo command to add a color point to a colormap.

Parameters:
  • model (ColorMapModel) – The colormap model to which the point will be added.

  • position (float) – Normalized position in the range [0, 1].

  • color (QColor) – The color of the new point.

  • index (int, optional) – Index at which to insert the point (for discrete colormaps). If None, the point is inserted in order by position.

Notes

On redo, a new ColorPoint is added at the specified position. On undo, the inserted point is removed.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Execute the add operation.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Revert the add operation by removing the inserted point.

redo()[source]#

Execute the add operation.

undo()[source]#

Revert the add operation by removing the inserted point.

class common.ColormapEditor.ChangeColor(model, index, new_color)[source]#

Bases: QUndoCommand

Undo/redo command to change the color of an existing point.

Parameters:
  • model (ColorMapModel) – The colormap model to modify.

  • index (int) – Index of the point whose color will be changed.

  • new_color (QColor) – The new color for the point.

Notes

On redo, applies the new color. On undo, restores the old color.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Apply the new color to the color point.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Restore the original color to the color point.

redo()[source]#

Apply the new color to the color point.

undo()[source]#

Restore the original color to the color point.

class common.ColormapEditor.ColorMapModel(parent=None)[source]#

Bases: QObject

Shared model that manages color points and an undo/redo stack.

This model is used by both discrete and continuous colormap editors. It supports adding, removing, moving, and modifying color points, while maintaining an undo/redo history. It can also export the current set of points as a matplotlib colormap.

Signals:

modelChanged (pyqtSigna(None)) – Emits a signal whenever the model is modified.

color_points#

Current list of color points in the colormap.

Type:

list of ColorPoint

undo_stack#

Undo/redo stack for all operations on the model.

Type:

QUndoStack

unsaved#

Whether the model has unsaved changes.

Type:

bool

is_discrete#

If True, the colormap is discrete. Otherwise, continuous.

Type:

bool

reverse_points()[source]#

Reverse the order of color points in the colormap.

change_color(index, new_color)[source]#

Change the color of a specific control point.

add_point(position, color, index=None)[source]#

Add a new color point at the given position.

delete_point(index)#

Remove a color point at the given index.

space_evenly_points()[source]#

Evenly space all color points along the colormap.

get_colors()[source]#

Return a list of QColor objects representing the current colormap.

is_circular_colormap()[source]#

Return True if the colormap is suitable for circular axes.

is_ternary_colormap()[source]#

Return True if the colormap is suitable for ternary axes.

Methods

add_point(position, color[, index])

Add a color point.

blockSignals(self, b)

change_color(index, new_color)

Change the color of an existing point.

childEvent(self, a0)

children(self)

connectNotify(self, signal)

customEvent(self, a0)

deleteLater(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, a0)

eventFilter(self, a0, a1)

findChild(-> QObjectT)

findChildren(...)

get_colors()

Get the list of colors.

inherits(self, classname)

installEventFilter(self, a0)

isQuickItemType(self)

isSignalConnected(self, signal)

isWidgetType(self)

isWindowType(self)

is_circular_colormap()

Check if the colormap is circular.

is_ternary_colormap()

Check if the colormap is ternary.

killTimer(self, id)

metaObject(self)

moveToThread(self, thread)

move_point(source_index, target_index)

Move a color point to a new index.

objectName(self)

on_clean_changed(clean)

Handle undo stack clean state changes.

on_index_changed(index)

Handle undo/redo index changes.

parent(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, signal)

removeEventFilter(self, a0)

remove_point(index)

Remove a color point.

reverse_points()

Reverse the order of all color points.

sender(self)

senderSignalIndex(self)

setObjectName(self, name)

setParent(self, a0)

setProperty(self, name, value)

set_points(points)

Set the full list of color points.

signalsBlocked(self)

space_evenly_points()

Space all color points evenly between 0 and 1.

startTimer(self, interval[, timerType])

thread(self)

timerEvent(self, a0)

to_mpl_colormap()

Convert the model to a matplotlib colormap.

tr(sourceText[, disambiguation, n])

destroyed

modelChanged

objectNameChanged

add_point(position: float, color: QColor, index: int = None)[source]#

Add a color point.

Parameters:
  • position (float) – Normalized position in the range [0, 1] for continuous colormaps.

  • color (QColor) – The color of the new point.

  • index (int, optional) – Index at which to insert the point for discrete colormaps.

change_color(index: int, new_color: QColor)[source]#

Change the color of an existing point.

Parameters:
  • index (int) – Index of the color point to modify.

  • new_color (QColor) – The new color.

get_colors() List[QColor][source]#

Get the list of colors.

Returns:

Current colors in the colormap.

Return type:

list of QColor

is_circular_colormap()[source]#

Check if the colormap is circular.

Returns:

True if the first and last colors are approximately equal, False otherwise.

Return type:

bool

is_ternary_colormap()[source]#

Check if the colormap is ternary.

Returns:

True if the colormap has 3 or 4 points, False otherwise.

Return type:

bool

modelChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

move_point(source_index: int, target_index: int)[source]#

Move a color point to a new index.

Parameters:
  • source_index (int) – Current index of the color point.

  • target_index (int) – Target index for the color point.

on_clean_changed(clean: bool)[source]#

Handle undo stack clean state changes.

Parameters:

clean (bool) – True if the undo stack is clean (saved), False otherwise.

on_index_changed(index: int)[source]#

Handle undo/redo index changes.

Parameters:

index (int) – Current index of the undo stack.

remove_point(index: int)[source]#

Remove a color point.

Parameters:

index (int) – Index of the color point to remove.

reverse_points()[source]#

Reverse the order of all color points.

set_points(points: list[ColorPoint])[source]#

Set the full list of color points.

Parameters:

points (list of ColorPoint) – New list of color points to replace the current ones.

space_evenly_points()[source]#

Space all color points evenly between 0 and 1.

to_mpl_colormap()[source]#

Convert the model to a matplotlib colormap.

Returns:

A ListedColormap if discrete, otherwise a LinearSegmentedColormap.

Return type:

matplotlib.colors.Colormap

class common.ColormapEditor.ColorPoint(position: float, color: QColor)[source]#

Bases: object

A control point in a colormap.

Represents a single color at a given position in a discrete or continuous colormap.

Parameters:
  • position (float) – Normalized location of the point in the range [0.0, 1.0].

  • color (QColor) – The color at this point.

to_rgb_tuple()[source]#

Convert the QColor to an (R, G, B) tuple in the [0, 1] range.

Examples

>>> cp = ColorPoint(0.5, QColor(255, 0, 0))
>>> cp.to_rgb_tuple()
(1.0, 0.0, 0.0)

Methods

to_rgb_tuple()

Convert the color to an RGB tuple in [0, 1] range.

color: QColor#
position: float#
to_rgb_tuple() Tuple[float, float, float][source]#

Convert the color to an RGB tuple in [0, 1] range.

Returns:

A 3-tuple (r, g, b), where each value is between 0.0 and 1.0.

Return type:

tuple of float

Examples

>>> cp = ColorPoint(0.5, QColor(0, 128, 255))
>>> cp.to_rgb_tuple()
(0.0, 0.5019607843137255, 1.0)
class common.ColormapEditor.ColormapEditorDialog(existing_colormaps: Dict[str, any] = None, title='Colormap Editor', parent=None)[source]#

Bases: QDialog

Main colormap editor dialog.

Provides an interactive interface for creating, editing, previewing, and saving colormaps. Supports discrete and continuous colormaps, color picking, colorblindness simulation, and CSV import/export.

Parameters:
  • existing_colormaps (dict, optional) – Dictionary of existing colormaps. Keys are colormap names and values are lists of QColor objects. Default is None.

  • title (str, optional) – Window title for the dialog. Default is “Colormap Editor”.

  • parent (QWidget, optional) – Parent widget. Default is None.

model#

Colormap data model that holds color points and manages undo/redo.

Type:

ColorMapModel

colormap_widget#

Widget for selecting and switching colormaps.

Type:

ColormapSelector

discrete_widget#

Widget for editing discrete colormaps.

Type:

DiscreteColorWidget

continuous_widget#

Widget for editing continuous colormaps.

Type:

ContinuousColorWidget

colorbar_widget#

Widget for previewing colormaps in linear form.

Type:

ColormapPreviewWidget

preview_widget#

Widget for image-based preview of colormaps.

Type:

ColormapPreviewWidget

picker#

Widget for picking colors from an image.

Type:

ImageColorPicker

hex_display#

Displays the current color as a hex string.

Type:

QLineEdit

undo_action#

Undo action connected to the model’s undo stack.

Type:

QAction

redo_action#

Redo action connected to the model’s undo stack.

Type:

QAction

setup_ui()[source]#

Set up the main dialog layout, toolbars, menus, and widgets.

closeEvent(event)[source]#

Reject the dialog when closed to discard changes.

update_axes_style_action()[source]#

Enable/disable axes style action depending on the colormap type.

on_axes_style_changed()[source]#

Cycle through allowed axes styles (linear, circular, ternary).

set_axes_style(style)[source]#

Set the axes style icon and preview group size.

on_colormap_changed(source, colormap_name)[source]#

Handle loading a new colormap from Matplotlib, Crameri, or custom.

on_preview_mode_changed(mode)[source]#

Change colorblind simulation preview mode.

on_discrete_toggled(is_discrete)[source]#

Switch between discrete and continuous colormap editing.

on_hex_changed()[source]#

Apply color from hex string to selected points.

set_hex_display_color()[source]#

Update hex display border color based on QLineEdit text.

on_color_picked(new_color)[source]#

Apply color picked from image to selected points or add new point.

update_hex_display(qcolor)[source]#

Update hexEdit box with the currently selected color.

on_selection_changed(selected_index)[source]#

Handle selection change in continuous mode.

on_discrete_selection_changed(selected_index)[source]#

Handle selection change in discrete mode.

update_button_states()[source]#

Enable/disable add/delete buttons based on selection and mode.

add_control_point()[source]#

Add a new color point or control point depending on mode.

delete_control_point()[source]#

Delete selected color/control point depending on mode.

toggle_preview()[source]#

Show or hide the preview panel.

toggle_picker()[source]#

Show or hide the image color picker.

update_preview()[source]#

Refresh colormap previews for both linear and image preview widgets.

create_new_colormap()[source]#

Create a new colormap with two default points (black and white).

create_new_colormap_entry()[source]#

Add a new “untitled” entry to the colormap combobox.

load_csv()[source]#

Load colormaps from a CSV file and populate the custom colormap list.

save_colormap()[source]#

Save the current colormap to a CSV file.

palette_from_image(colors)[source]#

Create a colormap from a list of colors sampled from an image.

get_colormodel()[source]#

Return the current colormap model object.

Methods

accept(self)

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

add_control_point()

Add a new color point or control point.

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Handle closing the dialog.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

create_new_colormap()

Create a new empty colormap with default black and white points.

create_new_colormap_entry()

Add a new entry in the colormap combobox for a new "untitled" colormap.

cursor(self)

customEvent(self, a0)

deleteLater(self)

delete_control_point()

Delete the currently selected color/control point.

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

done(self, a0)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

exec(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_colormodel()

Return the current colormap model.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isSizeGripEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

load_csv()

Load custom colormaps from a CSV file.

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

on_axes_style_changed()

Cycle through allowed axes styles.

on_color_picked(new_color)

Apply color picked from the image color picker.

on_colormap_changed([source, colormap_name])

Handle a colormap selection change.

on_discrete_selection_changed(selected_index)

Handle selection changes in discrete colormap mode.

on_discrete_toggled(is_discrete)

Toggle between discrete and continuous colormap editing.

on_hex_changed()

Apply color from hex string to currently selected color points.

on_preview_mode_changed(mode)

Update preview mode for colorblind simulation.

on_selection_changed(selected_index)

Handle selection changes in continuous colormap mode.

open(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

palette_from_image(colors)

Create a colormap from a list of colors sampled from an image.

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

reject(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

result(self)

saveGeometry(self)

save_colormap()

Save the current colormap to a CSV file.

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModal(self, modal)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setResult(self, r)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeGripEnabled(self, a0)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_axes_style(style)

Set the axes style for the preview widget.

set_hex_display_color()

Update the border color of the hex display based on the current text.

setup_ui()

Set up the user interface of the dialog.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toggle_picker()

Show or hide the image color picker panel.

toggle_preview()

Show or hide the preview panel.

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_axes_style_action()

Enable or disable axes style actions depending on allowed colormap types.

update_button_states()

Update the enabled/disabled state of add/delete buttons.

update_hex_display(qcolor)

Update the hex display box with the currently selected color.

update_preview()

Refresh both colorbar and image previews.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DialogCode

PaintDeviceMetric

RenderFlag

accepted

customContextMenuRequested

destroyed

finished

objectNameChanged

rejected

windowIconChanged

windowIconTextChanged

windowTitleChanged

add_control_point()[source]#

Add a new color point or control point.

Adds a new color in discrete mode or a control point in continuous mode.

closeEvent(event)[source]#

Handle closing the dialog.

Rejects the dialog to discard unsaved changes.

Parameters:

event (QCloseEvent) – The close event.

create_new_colormap()[source]#

Create a new empty colormap with default black and white points.

Updates the model, combobox entries, and refreshes previews.

create_new_colormap_entry()[source]#

Add a new entry in the colormap combobox for a new “untitled” colormap.

delete_control_point()[source]#

Delete the currently selected color/control point.

Deletes the selected color in discrete mode or selected control point in continuous mode.

get_colormodel()[source]#

Return the current colormap model.

Returns:

The current colormap model containing color points and undo stack.

Return type:

ColorMapModel

load_csv()[source]#

Load custom colormaps from a CSV file.

Reads hex color data from a CSV file, updates existing colormaps, and refreshes the colormap selection combobox.

Raises:

QMessageBox.warning – If the file cannot be loaded or no valid colormaps are found.

on_axes_style_changed()[source]#

Cycle through allowed axes styles.

Changes the axes style of the preview widget among linear, circular, or ternary.

on_color_picked(new_color)[source]#

Apply color picked from the image color picker.

Parameters:

new_color (str) – Color in hex format (e.g., “#RRGGBB”).

on_colormap_changed(source: str = 'Matplotlib', colormap_name: str = 'viridis')[source]#

Handle a colormap selection change.

Parameters:
  • source (str) – The source of the colormap, e.g., “Matplotlib”, “Crameri”, or “Custom”.

  • colormap_name (str) – Name of the selected colormap.

on_discrete_selection_changed(selected_index: int)[source]#

Handle selection changes in discrete colormap mode.

Parameters:

selected_index (int) – Index of the currently selected color.

on_discrete_toggled(is_discrete: bool)[source]#

Toggle between discrete and continuous colormap editing.

Parameters:

is_discrete (bool) – True if switching to discrete mode, False for continuous.

on_hex_changed()[source]#

Apply color from hex string to currently selected color points.

If valid hex string is entered in hex_display, updates the selected points in discrete or continuous mode.

on_preview_mode_changed(mode: str)[source]#

Update preview mode for colorblind simulation.

Parameters:

mode (str) – Preview mode: ‘normal’, ‘grayscale’, ‘deuteranopia’, ‘protanopia’, ‘tritanopia’.

on_selection_changed(selected_index: int)[source]#

Handle selection changes in continuous colormap mode.

Parameters:

selected_index (int) – Index of the currently selected control point.

palette_from_image(colors)[source]#

Create a colormap from a list of colors sampled from an image.

Parameters:

colors (list) – List of color strings or QColor objects sampled from an image.

save_colormap()[source]#

Save the current colormap to a CSV file.

Prompts the user for a filename and colormap name, writes hex colors to the file, and updates the undo stack.

Raises:

QMessageBox.warning – If there is no colormap data or the file cannot be written.

set_axes_style(style)[source]#

Set the axes style for the preview widget.

Parameters:

style (str) – Axes style: “linear”, “circular”, or “ternary”.

set_hex_display_color()[source]#

Update the border color of the hex display based on the current text.

The QLineEdit border color is updated to match the hex color entered.

setup_ui()[source]#

Set up the user interface of the dialog.

Initializes layouts, toolbars, menu bars, color widgets, preview panels, and connects signals to slots.

toggle_picker()[source]#

Show or hide the image color picker panel.

Adds/removes the picker widget in the layout and updates the preview.

toggle_preview()[source]#

Show or hide the preview panel.

Adds/removes the preview widget in the layout and updates its contents.

update_axes_style_action()[source]#

Enable or disable axes style actions depending on allowed colormap types.

Updates the icon, allowed axes styles, and preview widget configuration.

update_button_states()[source]#

Update the enabled/disabled state of add/delete buttons.

Buttons are enabled/disabled based on selection and mode constraints.

update_hex_display(qcolor)[source]#

Update the hex display box with the currently selected color.

Parameters:

qcolor (QColor) – The color to display in hex format.

update_preview()[source]#

Refresh both colorbar and image previews.

Updates the preview widgets if colormap data is present and preview is visible.

class common.ColormapEditor.ColormapPreviewWidget(plot_type='linear', parent=None)[source]#

Bases: FigureCanvasQTAgg

Widget for previewing colormaps with optional colorblindness simulation.

This widget displays a colormap in various formats (linear colorbar, circular wheel, ternary diagram, or image). It supports previewing under different simulated vision conditions such as grayscale or common types of colorblindness.

Parameters:
  • plot_type ({"linear", "circular", "ternary", "image"}, default="linear") – The type of visualization to use for previewing the colormap.

  • parent (QWidget, optional) – Parent widget for Qt ownership.

set_colormap(model)[source]#

Sets the colormap model to preview and updates the display.

set_preview_mode(mode)[source]#

Sets the preview mode and updates the display.

update_preview()[source]#

Updates the preview display according to the current colormap and mode.

simulate_colorblind_view(cmap)[source]#

Simulates the selected colorblindness mode on a colormap or list of colors.

Attributes:
button_pick_id
callbacks
device_pixel_ratio

The ratio of physical to logical pixels used for the canvas on screen.

fixed_dpi
scroll_pick_id

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blit([bbox])

Blit the canvas in bbox (default entire canvas).

blockSignals(self, b)

buffer_rgba()

Get the image as a memoryview to the renderer's buffer.

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

draw()

Render the figure, and queue a request for a Qt draw.

draw_idle()

Queue redraw of the Agg buffer and request Qt paintEvent.

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

flush_events()

Flush the GUI events for the figure.

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_default_filename()

Return a string, which includes extension, suitable for use as a default filename.

get_default_filetype()

Return the default savefig file format as specified in :rc:`savefig.format`.

get_supported_filetypes()

Return dict of savefig file formats supported by this backend.

get_supported_filetypes_grouped()

Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].

get_width_height(*[, physical])

Return the figure width and height in integral points or pixels.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

grab_mouse(ax)

Set the child ~.axes.Axes which is grabbing the mouse events.

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inaxes(xy)

Return the topmost visible ~.axes.Axes containing the point xy.

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

is_saving()

Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

manager_class

alias of FigureManagerQT

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseEventCoords([pos])

Calculate mouse coordinates in physical pixels.

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

mpl_connect(s, func)

Bind function func to event s.

mpl_disconnect(cid)

Disconnect the callback with id cid.

nativeEvent(self, eventType, message)

nativeParentWidget(self)

new_manager(figure, num)

Create a new figure manager for figure, using this canvas class.

new_timer([interval, callbacks])

Create a new backend-specific subclass of .Timer.

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Copy the image from the Agg canvas to the qt.drawable.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

print_figure(*args, **kwargs)

Render the figure to hardcopy.

print_jpeg(filename_or_obj, *[, metadata, ...])

Write the figure to a JPEG file.

print_jpg(filename_or_obj, *[, metadata, ...])

Write the figure to a JPEG file.

print_png(filename_or_obj, *[, metadata, ...])

Write the figure to a PNG file.

print_tif(filename_or_obj, *[, metadata, ...])

Write the figure to a TIFF file.

print_tiff(filename_or_obj, *[, metadata, ...])

Write the figure to a TIFF file.

print_webp(filename_or_obj, *[, metadata, ...])

Write the figure to a WebP file.

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

release_mouse(ax)

Release the mouse grab held by the ~.axes.Axes ax.

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_colormap(model)

Set the colormap model to preview.

set_cursor(cursor)

Set the current cursor.

set_preview_mode(mode)

Set the preview mode for colorblindness simulation.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

simulate_colorblind_view(cmap)

Apply a colorblindness simulation to a colormap or color list.

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

start_event_loop([timeout])

Start a blocking event loop.

statusTip(self)

stop_event_loop([event])

Stop the current blocking event loop.

style(self)

styleSheet(self)

switch_backends(FigureCanvasClass)

[Deprecated] Instantiate an instance of FigureCanvasClass

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tostring_argb()

Get the image as ARGB bytes.

tostring_rgb()

[Deprecated] Get the image as RGB bytes.

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_preview()

Update the preview display.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

copy_from_bbox

customContextMenuRequested

destroyed

drawRectangle

get_renderer

minumumSizeHint

objectNameChanged

print_raw

print_rgba

print_to_buffer

restore_region

windowIconChanged

windowIconTextChanged

windowTitleChanged

set_colormap(model)[source]#

Set the colormap model to preview.

Parameters:

model (object) – Colormap model instance with a to_mpl_colormap() method and a color_points attribute. The model defines the colors and interpolation strategy for generating a colormap.

set_preview_mode(mode: str)[source]#

Set the preview mode for colorblindness simulation.

Parameters:

mode ({"normal", "grayscale", "protanopia", "deuteranopia", "tritanopia", ...}) – Mode for simulating different types of vision. "normal" shows the colormap without simulation.

simulate_colorblind_view(cmap)[source]#

Apply a colorblindness simulation to a colormap or color list.

Parameters:

cmap (Colormap or list of QColor/tuple or QColor) – The colormap or list of colors to transform. Can be a Matplotlib colormap, a list of QColor objects, or RGB tuples.

Returns:

transformed – Transformed version of the input with simulated vision applied. Type matches the input (colormap, list of colors, or single color).

Return type:

Colormap, list of tuple, or tuple

Notes

  • Simulation matrices are applied as linear RGB transformations.

  • Supported preview modes are defined in cb_matrices.

update_preview()[source]#

Update the preview display.

Rebuilds the Matplotlib figure and redraws the colormap visualization based on the current model, plot type, and preview mode.

Notes

  • For plot_type="linear", shows a horizontal colorbar.

  • For plot_type="circular", shows a circular polar plot.

  • For plot_type="ternary", shows a ternary diagram with color blending.

  • For plot_type="image", shows a test image with the colormap applied.

class common.ColormapEditor.ColormapSelector(custom_maps=None, parent=None)[source]#

Bases: QWidget

A widget for selecting colormaps from multiple sources.

Provides a dropdown to choose between colormap sources (Matplotlib, Crameri, and custom maps), a search box to filter names, and a combobox to select the colormap itself. Emits a signal when the selected colormap changes.

Signals:

colormapChanged (pyqtSignal(str, str)) – Emitted when the user selects a colormap. The signal carries two strings: - The colormap source name (e.g., “Matplotlib”, “Crameri”, “Custom”). - The selected colormap name.

Parameters:
  • custom_maps (list of str, optional) – A list of custom colormap names to include under the “Custom” source. Defaults to an empty list.

  • parent (QWidget, optional) – The parent widget, by default None.

maps#

Dictionary of colormap sources and their available colormap names.

Type:

dict of {str: list of str}

source_combobox#

Dropdown to select the colormap source.

Type:

QComboBox

search_box#

Text box to filter colormap names.

Type:

QLineEdit

cmap_combobox#

Dropdown to select the colormap from the current source.

Type:

QComboBox

update_cmap_combo()[source]#

Update the available colormaps based on the current source and search filter.

get_selected_cmap()[source]#

Emit the colormapChanged signal with the currently selected source and colormap name.

Examples

>>> selector = ColormapSelector(custom_maps=["my_cmap"])
>>> selector.colormapChanged.connect(lambda src, cmap: print(src, cmap))

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_selected_cmap()

Return the currently selected colormap name.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_cmap_combo()

Update colormap combobox based on current source and search.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

colormapChanged

customContextMenuRequested

destroyed

objectNameChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

colormapChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

get_selected_cmap()[source]#

Return the currently selected colormap name.

update_cmap_combo()[source]#

Update colormap combobox based on current source and search.

class common.ColormapEditor.ContinuousColorWidget(parent=None)[source]#

Bases: QWidget

Widget for editing continuous colormaps with draggable triangular control points.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

add_control_point()

Add a new control point at the largest gap between existing points.

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

change_point_color(index)

Change the color of a control point using a color selection dialog.

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

delete_selected_point()

Delete the currently selected control point, if allowed.

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

draw_triangular_handle(painter, x, color, ...)

Draw an equilateral triangular handle at a given x position.

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_color_at_position(position)

Get the interpolated color at a given normalized position along the colormap.

get_colormap_x(position)

Convert a normalized colormap position (0-1) to widget x coordinate.

get_handle_bounds(x)

Get the bounding rectangle of a triangular handle.

get_position_from_x(x)

Convert a widget x coordinate to a normalized colormap position.

get_selected_point()

Get the index of the currently selected point.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(event)

Handle double-click events to add a new control point or change a point's color.

mouseGrabber()

mouseMoveEvent(event)

Handle mouse move events to drag a control point or update cursor shape.

mousePressEvent(event)

Handle mouse press events to select or start dragging a control point.

mouseReleaseEvent(event)

Handle mouse release events to finalize dragging a control point.

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Paint the widget, including the colormap gradient and control points.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

space_evenly_color_points()

Evenly space all control points along the colormap.

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

selectionChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

Widget for editing continuous colormaps with draggable triangular control points.

This widget allows users to interactively edit a continuous colormap by dragging triangular handles, adding or removing points, and changing their colors. The widget emits signals when the selection changes.

Signals:

selectionChanged (pyqtSignal(int)) – Signal emitted when the selected point changes. Sends the index of the selected point, or -1 if no point is selected.

Parameters:

parent (QWidget, optional) – Parent widget which should have a model attribute providing the colormap data and signals.

get_selected_point()[source]#

Returns the index of the currently selected control point (-1 if none).

add_control_point()[source]#

Adds a new control point at the largest gap between existing points.

delete_selected_point()[source]#

Deletes the currently selected control point if allowed.

space_evenly_color_points()[source]#

Evenly spaces all control points along the colormap.

get_color_at_position(position)[source]#

Returns the interpolated color at a given normalized position (0-1).

change_point_color(index)[source]#

Opens a color dialog to change the color of a specified control point.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

add_control_point()

Add a new control point at the largest gap between existing points.

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

change_point_color(index)

Change the color of a control point using a color selection dialog.

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

delete_selected_point()

Delete the currently selected control point, if allowed.

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

draw_triangular_handle(painter, x, color, ...)

Draw an equilateral triangular handle at a given x position.

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_color_at_position(position)

Get the interpolated color at a given normalized position along the colormap.

get_colormap_x(position)

Convert a normalized colormap position (0-1) to widget x coordinate.

get_handle_bounds(x)

Get the bounding rectangle of a triangular handle.

get_position_from_x(x)

Convert a widget x coordinate to a normalized colormap position.

get_selected_point()

Get the index of the currently selected point.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(event)

Handle double-click events to add a new control point or change a point's color.

mouseGrabber()

mouseMoveEvent(event)

Handle mouse move events to drag a control point or update cursor shape.

mousePressEvent(event)

Handle mouse press events to select or start dragging a control point.

mouseReleaseEvent(event)

Handle mouse release events to finalize dragging a control point.

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Paint the widget, including the colormap gradient and control points.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

space_evenly_color_points()

Evenly space all control points along the colormap.

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

selectionChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

add_control_point()[source]#

Add a new control point at the largest gap between existing points.

Returns:

True if a new point was added; False if maximum number of points reached.

Return type:

bool

change_point_color(index: int)[source]#

Change the color of a control point using a color selection dialog.

Parameters:

index (int) – Index of the control point to change.

delete_selected_point()[source]#

Delete the currently selected control point, if allowed.

Returns:

True if a point was deleted; False otherwise.

Return type:

bool

draw_triangular_handle(painter: QPainter, x: float, color: QColor, is_selected: bool)[source]#

Draw an equilateral triangular handle at a given x position.

Parameters:
  • painter (QPainter) – The painter used to draw the handle.

  • x (float) – Horizontal position of the handle in widget coordinates.

  • color (QColor) – Color of the handle.

  • is_selected (bool) – Whether this handle is currently selected. Determines border thickness.

get_color_at_position(position: float) QColor[source]#

Get the interpolated color at a given normalized position along the colormap.

Parameters:

position (float) – Normalized position (0-1) along the colormap.

Returns:

Interpolated color at the given position.

Return type:

QColor

get_colormap_x(position: float) float[source]#

Convert a normalized colormap position (0-1) to widget x coordinate.

Parameters:

position (float) – Normalized position along the colormap (0 = left, 1 = right).

Returns:

Corresponding x coordinate in widget space.

Return type:

float

get_handle_bounds(x: float) QRectF[source]#

Get the bounding rectangle of a triangular handle.

Parameters:

x (float) – Horizontal position of the handle in widget coordinates.

Returns:

Bounding rectangle of the handle.

Return type:

QRectF

get_position_from_x(x: float) float[source]#

Convert a widget x coordinate to a normalized colormap position.

Parameters:

x (float) – Widget x coordinate.

Returns:

Normalized position (0-1) along the colormap.

Return type:

float

get_selected_point() int[source]#

Get the index of the currently selected point.

Returns:

Index of selected point, or -1 if no point is selected.

Return type:

int

mouseDoubleClickEvent(event: QMouseEvent)[source]#

Handle double-click events to add a new control point or change a point’s color.

Parameters:

event (QMouseEvent) – Mouse double-click event information.

mouseMoveEvent(event: QMouseEvent)[source]#

Handle mouse move events to drag a control point or update cursor shape.

Parameters:

event (QMouseEvent) – Mouse move event information.

mousePressEvent(event: QMouseEvent)[source]#

Handle mouse press events to select or start dragging a control point.

Parameters:

event (QMouseEvent) – Mouse press event information.

mouseReleaseEvent(event: QMouseEvent)[source]#

Handle mouse release events to finalize dragging a control point.

Parameters:

event (QMouseEvent) – Mouse release event information.

paintEvent(event)[source]#

Paint the widget, including the colormap gradient and control points.

Parameters:

event (QPaintEvent) – Paint event triggering this redraw.

Notes

  • Draws a gradient for the current colormap.

  • Draws triangular handles for control points, highlighting the selected one.

selectionChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

space_evenly_color_points()[source]#

Evenly space all control points along the colormap.

Notes

Delegates to the model’s space_evenly_points() method.

class common.ColormapEditor.DiscreteColorWidget(parent=None)[source]#

Bases: QWidget

Widget for editing discrete colormaps with draggable buttons.

This widget provides an interface to edit a discrete colormap defined in a model. Users can add, remove, reorder, and recolor discrete color points. Each color is represented by a draggable button (DraggableColorButton).

Parameters:

parent (QWidget, optional) – Parent widget. Must provide a model attribute with color_points and signals for synchronization.

Signals:

selectionChanged (pyqtSignal(int)) – Emitted when the selection of color buttons changes. The integer corresponds to the index of the color point, or -1 if no selection exists.

model#

The model that manages colormap data. Expected to provide color_points, modelChanged, and methods such as add_point, remove_point, and change_color.

Type:

object

selected_indices#

The indices of the currently selected color buttons.

Type:

set of int

buttons#

The list of color button widgets currently displayed.

Type:

list of DraggableColorButton

layout#

Layout used to arrange color buttons horizontally.

Type:

QHBoxLayout

update_buttons()[source]#

Rebuilds the button widgets to match the current model.

handle_color_click(index)[source]#

Handles selection or deselection of a color button.

change_color(index)[source]#

Opens a dialog to change the color of a specific point.

update_selection_display()[source]#

Updates the visual display of which buttons are selected.

handle_color_move(source_index, target_index)[source]#

Handles drag-and-drop reordering of colors.

add_color()[source]#

Adds a new color based on current selection or at the end.

delete_selected()[source]#

Deletes currently selected color point(s).

get_selected_count()[source]#

Returns the number of currently selected colors.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

add_color()

Add a new color point to the colormap.

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

change_color(index)

Open a color dialog to change a color at a given index.

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

delete_selected()

Delete the currently selected color point(s).

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_selected_count()

Get the number of selected colors.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

handle_color_click(index)

Handle color button click events.

handle_color_move(source_index, target_index)

Handle drag-and-drop reordering of color points.

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

setup_ui()

Initialize the layout and UI elements.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_buttons()

Refresh the color buttons to match the model.

update_selection_display()

Update the visual selection state of all buttons.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

selectionChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

add_color()[source]#

Add a new color point to the colormap.

Returns:

True if a color was successfully added, False otherwise.

Return type:

bool

Notes

  • If no points exist, adds white at position 0.0.

  • If no selection exists, duplicates the last color at position 1.0.

  • If a single selection exists, inserts a color after it.

  • If multiple adjacent selections exist, inserts an interpolated color between them.

change_color(index: int)[source]#

Open a color dialog to change a color at a given index.

Parameters:

index (int) – Index of the color point to modify.

Notes

Calls the model’s change_color method if a valid color is chosen from the dialog.

delete_selected()[source]#

Delete the currently selected color point(s).

Notes

  • Deletes points in descending index order to avoid shifting.

  • Updates selected_indices after deletion.

  • Emits selectionChanged with -1 if no points remain.

  • Otherwise, selects the closest remaining point.

get_selected_count() int[source]#

Get the number of selected colors.

Returns:

The number of currently selected color buttons.

Return type:

int

handle_color_click(index: int)[source]#

Handle color button click events.

Parameters:

index (int) – The index of the clicked color button.

Notes

Toggles the selection state of the button and emits the selectionChanged signal.

handle_color_move(source_index: int, target_index: int)[source]#

Handle drag-and-drop reordering of color points.

Parameters:
  • source_index (int) – Index of the dragged button.

  • target_index (int) – Index where the button is dropped.

Notes

  • Moves the corresponding ColorPoint in the model.

  • Reassigns positions evenly across all points.

  • Updates selection indices accordingly.

  • Rebuilds buttons and emits modelChanged.

selectionChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

setup_ui()[source]#

Initialize the layout and UI elements.

Notes

Creates a horizontal layout with spacing and initializes the list of buttons based on the model.

update_buttons()[source]#

Refresh the color buttons to match the model.

Notes

  • Deletes existing buttons and recreates them from self.model.color_points.

  • Updates button selection states.

  • Forces a layout and widget update.

update_selection_display()[source]#

Update the visual selection state of all buttons.

Notes

Ensures that the selected buttons are highlighted based on self.selected_indices.

class common.ColormapEditor.DraggableColorButton(color: QColor, index: int, parent=None)[source]#

Bases: QPushButton

A draggable color button for discrete colormap editing.

This widget represents a color entry in a discrete colormap. It supports selection, drag-and-drop reordering, and double-click color changes (delegated to the parent widget).

Parameters:
  • color (QColor) – The initial color of the button.

  • index (int) – Index of the button within the parent colormap editor.

  • parent (QWidget, optional) – Parent widget. If provided, must implement change_color and/or handle_color_move for full functionality.

color#

The current color of the button.

Type:

QColor

index#

The index of this button within the parent editor.

Type:

int

is_selected#

Whether the button is currently selected.

Type:

bool

drag_start_position#

Position of the mouse press event used to start drag detection.

Type:

QPoint or None

dragging#

Whether the button is currently being dragged.

Type:

bool

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

animateClick(self)

autoDefault(self)

autoExclusive(self)

autoFillBackground(self)

autoRepeat(self)

autoRepeatDelay(self)

autoRepeatInterval(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, e)

checkStateSet(self)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

click(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(event)

Handle drag enter events.

dragLeaveEvent(self, a0)

dragMoveEvent(event)

Handle drag move events.

dropEvent(event)

Handle drop events.

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, e)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

group(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

hitButton(self, pos)

icon(self)

iconSize(self)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isCheckable(self)

isChecked(self)

isDefault(self)

isDown(self)

isEnabled(self)

isEnabledTo(self, a0)

isFlat(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, e)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

menu(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(event)

Handle double-click events.

mouseGrabber()

mouseMoveEvent(event)

Handle mouse move events to initiate dragging.

mousePressEvent(event)

Handle mouse press events.

mouseReleaseEvent(event)

Handle mouse release events.

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextCheckState(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoDefault(self, a0)

setAutoExclusive(self, a0)

setAutoFillBackground(self, enabled)

setAutoRepeat(self, a0)

setAutoRepeatDelay(self, a0)

setAutoRepeatInterval(self, a0)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCheckable(self, a0)

setChecked(self, a0)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDefault(self, a0)

setDisabled(self, a0)

setDown(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFlat(self, a0)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setIcon(self, icon)

setIconSize(self, size)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMenu(self, menu)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcut(self, key)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setText(self, text)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_color(color)

Update the button color.

set_selected(selected)

Set the selection state of the button.

sharedPainter(self)

shortcut(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMenu(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

text(self)

thread(self)

timerEvent(self, e)

toggle(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_style()

Update the button's visual style.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

clicked

customContextMenuRequested

destroyed

objectNameChanged

pressed

released

toggled

windowIconChanged

windowIconTextChanged

windowTitleChanged

dragEnterEvent(event)[source]#

Handle drag enter events.

Parameters:

event (QDragEnterEvent) – The drag enter event.

Notes

Accepts the event if it contains text data (expected to be the source index of a dragged color).

dragMoveEvent(event)[source]#

Handle drag move events.

Parameters:

event (QDragMoveEvent) – The drag move event.

Notes

Accepts the event if it contains text data.

dropEvent(event)[source]#

Handle drop events.

Parameters:

event (QDropEvent) – The drop event containing the source button index.

Notes

If the drop is valid, notifies the parent widget via handle_color_move(source_index, target_index).

mouseDoubleClickEvent(event)[source]#

Handle double-click events.

Parameters:

event (QMouseEvent) – The mouse double-click event.

Notes

If not dragging, calls the parent widget’s change_color(index) method if it exists.

mouseMoveEvent(event)[source]#

Handle mouse move events to initiate dragging.

Parameters:

event (QMouseEvent) – The mouse move event.

Notes

If the left button is held and the mouse has moved beyond a small threshold, a drag operation is started. The button index is passed via QMimeData.

mousePressEvent(event)[source]#

Handle mouse press events.

Parameters:

event (QMouseEvent) – The mouse press event.

Notes

If the left button is pressed, the drag start position is recorded.

mouseReleaseEvent(event)[source]#

Handle mouse release events.

Parameters:

event (QMouseEvent) – The mouse release event.

Notes

Resets the dragging flag shortly after release to allow proper double-click detection.

set_color(color: QColor)[source]#

Update the button color.

Parameters:

color (QColor) – The new color to assign to the button.

set_selected(selected: bool)[source]#

Set the selection state of the button.

Parameters:

selected (bool) – If True, the button is highlighted as selected.

update_style()[source]#

Update the button’s visual style.

Notes

The background color is set to the current color. The border is drawn thicker if the button is selected.

class common.ColormapEditor.MoveColorPoint(model, source_index, target_index)[source]#

Bases: QUndoCommand

Undo/redo command to move a color point between indices.

Parameters:
  • model (ColorMapModel) – The colormap model to modify.

  • source_index (int) – The original index of the color point.

  • target_index (int) – The new index to which the point will be moved.

Notes

On redo, moves the point to the target index. On undo, moves it back to the source index.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Execute the move operation.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Execute the move operation.

redo()[source]#

Execute the move operation.

undo()[source]#

Execute the move operation.

class common.ColormapEditor.MoveContinuousPointCommand(model, index, old_pos, new_pos)[source]#

Bases: QUndoCommand

Undo/redo command to move a color point within a continuous colormap.

Parameters:
  • model (ColorMapModel) – The colormap model to modify.

  • index (int) – Index of the point being moved.

  • old_pos (float) – The original normalized position.

  • new_pos (float) – The new normalized position.

Notes

On redo, sets the point’s position to new_pos. On undo, restores the original old_pos.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Execute the position update to the new value.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Revert the position update to the old value.

redo()[source]#

Execute the position update to the new value.

undo()[source]#

Revert the position update to the old value.

class common.ColormapEditor.RemoveColorPoint(model, index)[source]#

Bases: QUndoCommand

Undo/redo command to remove a color point from a colormap.

Parameters:
  • model (ColorMapModel) – The colormap model to modify.

  • index (int) – Index of the point to remove.

Notes

On redo, removes the point at the given index. On undo, restores the point and its original positions.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Execute the remove operation by deleting the color point.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Revert the remove operation by restoring the deleted point.

redo()[source]#

Execute the remove operation by deleting the color point.

undo()[source]#

Revert the remove operation by restoring the deleted point.

class common.ColormapEditor.ReverseColorPoints(model)[source]#

Bases: QUndoCommand

Undo/redo command to reverse the order of color points.

Parameters:

model (ColorMapModel) – The colormap model to modify.

Notes

On redo, reverses the colormap. On undo, applies the reverse operation again to restore the original order.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Reverse the order of the color points.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Reverse the order again to restore the original state.

redo()[source]#

Reverse the order of the color points.

undo()[source]#

Reverse the order again to restore the original state.

class common.ColormapEditor.SpaceEvenlyPointsCommand(model)[source]#

Bases: QUndoCommand

Undo/redo command to distribute color points evenly across [0, 1].

Parameters:

model (ColorMapModel) – The colormap model to modify.

Notes

On redo, spaces all points evenly. On undo, restores the original positions.

Methods

actionText(self)

child(self, index)

childCount(self)

id(self)

isObsolete(self)

mergeWith(self, other)

redo()

Space all points evenly across the colormap range.

setObsolete(self, obsolete)

setText(self, text)

text(self)

undo()

Restore original positions of the color points.

redo()[source]#

Space all points evenly across the colormap range.

undo()[source]#

Restore original positions of the color points.

common.ColormapEditor.fix_positions(model)[source]#

Normalize and fix color point positions for a colormap model.

For discrete models, color points are evenly spaced between 0.0 and 1.0. For continuous models, boundary points are set to 0.0 and 1.0, and intermediate points are redistributed proportionally.

Parameters:

model (object) – The colormap model containing a list of color_points and an optional is_discrete attribute.

Returns:

model – The updated model with corrected point positions.

Return type:

object

Notes

  • For discrete models with one point, its position is set to 0.5.

  • For continuous models: * One point → positioned at 0.5. * Two points → fixed at 0.0 and 1.0. * Three or more points → endpoints fixed at 0.0 and 1.0, others

    evenly distributed in between.

common.ColormapEditor.fix_positions_after_removal(model, removed_position=None)[source]#

Adjust positions after removing a color point.

Ensures consistent spacing of color points after one is deleted. For discrete colormaps, points are evenly redistributed. For continuous colormaps, if an endpoint is removed, the remaining points are scaled to preserve the range [0.0, 1.0].

Parameters:
  • model (object) – The colormap model containing color_points and an optional is_discrete attribute.

  • removed_position (float, optional) – The position of the removed color point (0.0–1.0). Used to detect whether an endpoint was removed.

Returns:

model – The updated model with adjusted color point positions.

Return type:

object

Notes

  • For discrete models: * Points are always redistributed evenly.

  • For continuous models: * If an endpoint was removed, positions are linearly rescaled

    to restore 0.0 and 1.0 at the new boundaries.

common.ColormapEditor.get_cmr_colormap_names()[source]#

Get all available Crameri colormap names.

Scans the cmr module for attributes containing Crameri colormap names and returns a flat, sorted list without duplicates.

Returns:

A sorted list of unique Crameri colormap names.

Return type:

list of str

Examples

>>> names = get_cmr_colormap_names()
>>> "vik" in names
True

common.ColorPicker module#

Color Picker

Created on Sat Aug 16 2025

@author: Derrick Hasterok

class common.ColorPicker.ImageColorPicker(parent=None)[source]#

Bases: QWidget

Main widget that shows an image and a magnifier. Emits signals for picked colors.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(event)

Accept drag events containing images or file URLs.

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(event)

Handle drop events.

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(obj, event)

Filter mouse events on the image label.

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

on_image_mouse_click(widget_pos)

Pick color at the mouse position and emit colorPicked signal.

on_image_mouse_move(widget_pos)

Update magnifier based on mouse move over the image.

open_image()

Open an image from a file dialog and display it.

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

paste_image()

Paste an image from the system clipboard and display it.

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

qpixmap_to_pil()

Convert the current QPixmap to a PIL Image in RGB format.

raise_(self)

receivers(self, signal)

rect(self)

region_based_palette_qpixmap()

Generate a palette from the image using region-based K-means clustering.

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_pixmap(pixmap)

Set the displayed pixmap and convert to QImage for processing.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(event)

Zoom the displayed image on mouse wheel scroll.

widget_to_image_coords(widget_pos)

Convert widget coordinates to image pixel coordinates.

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

colorPicked

customContextMenuRequested

destroyed

objectNameChanged

paletteCreated

windowIconChanged

windowIconTextChanged

windowTitleChanged

colorPicked#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

dragEnterEvent(event)[source]#

Accept drag events containing images or file URLs.

Parameters:

event (QDragEnterEvent) – Drag event.

dropEvent(event)[source]#

Handle drop events. Accepts images or file URLs.

Parameters:

event (QDropEvent) – Drop event.

eventFilter(obj, event)[source]#

Filter mouse events on the image label.

Handles mouse move (update magnifier), click (pick color), and leave (hide magnifier).

Parameters:
  • obj (QObject) – Object that received the event.

  • event (QEvent) – The event object.

Returns:

True if the event was handled, otherwise False.

Return type:

bool

on_image_mouse_click(widget_pos: QPoint)[source]#

Pick color at the mouse position and emit colorPicked signal.

Parameters:

widget_pos (QPoint) – Mouse click position in widget coordinates.

on_image_mouse_move(widget_pos: QPoint)[source]#

Update magnifier based on mouse move over the image.

Parameters:

widget_pos (QPoint) – Mouse position in widget coordinates.

open_image()[source]#

Open an image from a file dialog and display it.

paletteCreated#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

paste_image()[source]#

Paste an image from the system clipboard and display it.

qpixmap_to_pil() Image[source]#

Convert the current QPixmap to a PIL Image in RGB format.

Returns:

The converted PIL image.

Return type:

PIL.Image.Image

region_based_palette_qpixmap()[source]#

Generate a palette from the image using region-based K-means clustering.

Downsamples the image, clusters colors, sorts by hue, and emits paletteCreated signal.

set_pixmap(pixmap: QPixmap)[source]#

Set the displayed pixmap and convert to QImage for processing.

Handles device pixel ratio and scales to fit the viewport if necessary.

Parameters:

pixmap (QPixmap) – Pixmap to display and process.

wheelEvent(event: QWheelEvent)[source]#

Zoom the displayed image on mouse wheel scroll.

Parameters:

event (QWheelEvent) – Mouse wheel event.

widget_to_image_coords(widget_pos: QPoint) Tuple[int, int][source]#

Convert widget coordinates to image pixel coordinates.

Parameters:

widget_pos (QPoint) – Position in widget coordinates.

Returns:

Corresponding (x, y) pixel coordinates in the image, or None if mapping is impossible.

Return type:

tuple of int or None

class common.ColorPicker.Magnifier(parent=None, grid_size: int = 15, zoom: int = 8, size: int = 180)[source]#

Bases: QWidget

Floating magnifier widget showing a zoomed region around a point in an image.

The magnifier is DPI-aware and expects (image, image_pos_x, image_pos_y) where image is a QImage in device pixel coordinates.

grid_size#

Number of pixels in the magnifier grid (default GRID_SIZE).

Type:

int

zoom#

Magnification factor for the preview (default DEFAULT_ZOOM).

Type:

int

preview_size#

Size of the magnifier preview in pixels (default MAG_PREVIEW_SIZE).

Type:

int

pixel_size#

Size of each magnified pixel in the preview.

Type:

int

_image#

Image being magnified.

Type:

QImage

_img_x#

X-coordinate of the center pixel in the image.

Type:

int

_img_y#

Y-coordinate of the center pixel in the image.

Type:

int

_center_color#

Color of the center pixel.

Type:

QColor

Parameters:
  • parent (QWidget, optional) – Parent widget.

  • grid_size (int) – Number of pixels in the magnifier grid.

  • zoom (int) – Magnification factor.

  • size (int) – Preview window size.

set_image_and_pos(image, img_x, img_y)[source]#

Set the image and center position for magnification.

paintEvent(event)[source]#

Paint the magnifier preview, showing the zoomed region, grid lines, and center color.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Paint the magnifier preview.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_image_and_pos(image, img_x, img_y)

Set the image and center position for magnification.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

paintEvent(event)[source]#

Paint the magnifier preview.

Draws the zoomed region with grid lines, highlights the center pixel, and displays a color swatch with RGB and hex values below the grid.

Parameters:

event (QPaintEvent) – The paint event from Qt.

set_image_and_pos(image: QImage, img_x: int, img_y: int)[source]#

Set the image and center position for magnification.

Set the image and center position (in image pixel coordinates) image must be a QImage in device pixels (not scaled).

Parameters:
  • image (QImage) – Source image in device pixels (not scaled).

  • img_x (int) – X-coordinate of the center pixel in image coordinates.

  • img_y (int) – Y-coordinate of the center pixel in image coordinates.

common.ColorPicker.sort_by_hue(colors)[source]#

Sort a list of RGB colors by their hue.

Parameters:

colors (list of tuple) – List of colors, each as a 3-tuple (R, G, B) with values in [0, 1] or [0, 255].

Returns:

List of colors sorted by their hue in HSV space.

Return type:

list of tuple

common.ColorSelector module#

class common.ColorSelector.ColorSelectorDialog(initial_color=None, parent=None)[source]#

Bases: QDialog

Color selector as a dialog that can return a color or None

Methods

accept()

Called when OK is pressed - save the selected color

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Handle window close button - same as cancel

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

done(self, a0)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(source, event)

Event filter: remove units when editing starts

exec(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_config_path()

Get path for storing color history

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isSizeGripEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

load_color_history()

Load color history from file

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

on_text_H_finished()

Handle hue editing finished: validate + update color

on_text_RGB_finished(source)

Handle RGB editing finished: validate + update color

on_text_SV_finished(source)

Handle saturation or value editing finished: validate + update color

open(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

reject()

Called when Cancel is pressed or dialog is closed without OK

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

restore_color(button)

When a history button is clicked, use its color.

result(self)

saveGeometry(self)

save_color()

Save current pick_color into history (button backgrounds).

save_color_history()

Save color history to file

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModal(self, modal)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setResult(self, r)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeGripEnabled(self, a0)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DialogCode

PaintDeviceMetric

RenderFlag

accepted

customContextMenuRequested

destroyed

finished

objectNameChanged

on_hover_color

on_pick_color

rejected

setupUI

windowIconChanged

windowIconTextChanged

windowTitleChanged

accept()[source]#

Called when OK is pressed - save the selected color

closeEvent(event)[source]#

Handle window close button - same as cancel

eventFilter(source, event)[source]#

Event filter: remove units when editing starts

get_config_path()[source]#

Get path for storing color history

load_color_history()[source]#

Load color history from file

on_hover_color(rgb)[source]#
on_pick_color(rgb)[source]#
on_text_H_finished()[source]#

Handle hue editing finished: validate + update color

on_text_RGB_finished(source)[source]#

Handle RGB editing finished: validate + update color

on_text_SV_finished(source)[source]#

Handle saturation or value editing finished: validate + update color

reject()[source]#

Called when Cancel is pressed or dialog is closed without OK

restore_color(button)[source]#

When a history button is clicked, use its color.

save_color()[source]#

Save current pick_color into history (button backgrounds).

save_color_history()[source]#

Save color history to file

setupUI()[source]#
class common.ColorSelector.DualPatch[source]#

Bases: QWidget

Shows two color patches: left = selected, right = under-mouse.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

set_hover

set_selected

windowIconChanged

windowIconTextChanged

windowTitleChanged

paintEvent(self, a0: QPaintEvent | None)[source]#
set_hover(rgb)[source]#
set_selected(rgb)[source]#
class common.ColorSelector.HueSlider(parent=None)[source]#

Bases: QSlider

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, e)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

hasTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

invertedAppearance(self)

invertedControls(self)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isSliderDown(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, ev)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximum(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimum(self)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, ev)

mousePressEvent(self, ev)

mouseReleaseEvent(self, ev)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

orientation(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

pageStep(self)

paintEngine(self)

paintEvent(self, ev)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

repeatAction(self)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setInvertedAppearance(self, a0)

setInvertedControls(self, a0)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximum(self, a0)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimum(self, a0)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setOrientation(self, a0)

setPageStep(self, a0)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setRange(self, min, max)

setRepeatAction(self, action[, ...])

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSingleStep(self, a0)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setSliderDown(self, a0)

setSliderPosition(self, a0)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTickInterval(self, ti)

setTickPosition(self, position)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setTracking(self, enable)

setUpdatesEnabled(self, enable)

setValue(self, a0)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

singleStep(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

sliderChange(self, change)

sliderPosition(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

tickInterval(self)

tickPosition(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

triggerAction(self, action)

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

value(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, e)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

SliderAction

SliderChange

TickPosition

actionTriggered

customContextMenuRequested

destroyed

objectNameChanged

rangeChanged

sliderMoved

sliderPressed

sliderReleased

valueChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

paintEvent(self, ev: QPaintEvent | None)[source]#
class common.ColorSelector.MainWindow[source]#

Bases: QMainWindow

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addDockWidget(addDockWidget)

addToolBar(-> None)

addToolBarBreak(self[, area])

adjustSize(self)

apply_color()

Handle Apply button in standalone mode

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

centralWidget(self)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, event)

contextMenuPolicy(self)

corner(self, corner)

create(self[, window, initializeWindow, ...])

createPopupMenu(self)

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dockOptions(self)

dockWidgetArea(self, dockwidget)

documentMode(self)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

iconSize(self)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

insertToolBar(self, before, toolbar)

insertToolBarBreak(self, before)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAnimated(self)

isDockNestingEnabled(self)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSeparator(self, pos)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

menuBar(self)

menuWidget(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeDockWidget(self, dockwidget)

removeEventFilter(self, a0)

removeToolBar(self, toolbar)

removeToolBarBreak(self, before)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeDocks(self, docks, sizes, orientation)

resizeEvent(self, a0)

restoreDockWidget(self, dockwidget)

restoreGeometry(self, geometry)

restoreState(self, state[, version])

saveGeometry(self)

saveState(self[, version])

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAnimated(self, enabled)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCentralWidget(self, widget)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCorner(self, corner, area)

setCursor(self, a0)

setDisabled(self, a0)

setDockNestingEnabled(self, enabled)

setDockOptions(self, options)

setDocumentMode(self, enabled)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setIconSize(self, iconSize)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMenuBar(self, menubar)

setMenuWidget(self, menubar)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusBar(self, statusbar)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabPosition(self, areas, tabPosition)

setTabShape(self, tabShape)

setTabletTracking(self, enable)

setToolButtonStyle(self, toolButtonStyle)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUnifiedTitleAndToolBarOnMac(self, set)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

splitDockWidget(self, after, dockwidget, ...)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusBar(self)

statusTip(self)

style(self)

styleSheet(self)

tabPosition(self, area)

tabShape(self)

tabifiedDockWidgets(self, dockwidget)

tabifyDockWidget(self, first, second)

tabletEvent(self, a0)

takeCentralWidget(self)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolBarArea(self, toolbar)

toolBarBreak(self, toolbar)

toolButtonStyle(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unifiedTitleAndToolBarOnMac(self)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockOption

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

iconSizeChanged

objectNameChanged

setupUI

tabifiedDockWidgetActivated

toolButtonStyleChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

apply_color()[source]#

Handle Apply button in standalone mode

setupUI()[source]#
class common.ColorSelector.TernaryHVWidget[source]#

Bases: QWidget

Ternary with vertices: Black (bottom-left), White (bottom-right), Pure Hue (top). A saturation multiplier slider can globally reduce S after picking from triangle.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mix_color(t)

RGB from barycentric weights with vertices B(0,0,0), W(1,1,1), H(pure hue).

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pure_hue_rgb()

Convert hue (0-1) to RGB tuple using HSV with full saturation and value

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_hue(h)

Set hue value (expects 0.0-1.0 range)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

triangle_vertices()

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

hoverColor

objectNameChanged

pickColor

set_saturation_scale

windowIconChanged

windowIconTextChanged

windowTitleChanged

hoverColor#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

mix_color(t)[source]#

RGB from barycentric weights with vertices B(0,0,0), W(1,1,1), H(pure hue).

mouseMoveEvent(self, a0: QMouseEvent | None)[source]#
mousePressEvent(self, a0: QMouseEvent | None)[source]#
paintEvent(self, a0: QPaintEvent | None)[source]#
pickColor#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

pure_hue_rgb()[source]#

Convert hue (0-1) to RGB tuple using HSV with full saturation and value

resizeEvent(self, a0: QResizeEvent | None)[source]#
set_hue(h)[source]#

Set hue value (expects 0.0-1.0 range)

set_saturation_scale(s)[source]#
sizeHint(self) QSize[source]#
triangle_vertices()[source]#
common.ColorSelector.fix_bounds(x)[source]#
common.ColorSelector.select_color(initial_color=None, parent=None)[source]#

Show color selector dialog and return selected color.

Parameters:
  • initial_color – Initial color as hex string (e.g., “#FF0000”) or None for white

  • parent – Parent widget for the dialog

Returns:

Selected color as hex string (e.g., “#FF0000”) or None if cancelled

common.CustomMplCanvas module#

class common.CustomMplCanvas.MplCanvas(fig=None, sub=111, parent=None, width=5, height=4, proj=None, ui=None, map_flag=False)[source]#

Bases: FigureCanvasQTAgg, Observable

Matplotlib canvas object for interactive plots

Parameters:
  • sub (int, optional) – Subplot location, by default 111

  • parent (object, optional) – Parent calling MplCanvas, by default None

  • width (int, optional) – Width in inches, by default 5

  • height (int, optional) – Height in inches, by default 4

  • proj (str, optional) – Projection, by default None

Attributes:
button_pick_id
callbacks
data

Return the stored pandas DataFrame.

device_pixel_ratio

The ratio of physical to logical pixels used for the canvas on screen.

distance

str : when distance tool is active, the distance of the line

fixed_dpi
plot_name

Return the stored pandas DataFrame.

scroll_pick_id
value

str : volue at mouse pointer location

xpos

str : x position of mouse pointer on canvas

ypos

str : y position of mouse pointer on canvas

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

add_observer(event_name, callback)

Register a callback function to be called when a property changes.

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blit([bbox])

Blit the canvas in bbox (default entire canvas).

blockSignals(self, b)

buffer_rgba()

Get the image as a memoryview to the renderer's buffer.

calculate_distance(p1, p2)

Calculuates distance on a figure

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

distanceOnClick(event)

Updates static endpoints of distance measuring line.

distanceOnMove(event)

Updates dynamic second point of distance measuring line.

distance_reset()

Resets distance variables and clears plot

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

draw()

Render the figure, and queue a request for a Qt draw.

draw_idle()

Queue redraw of the Agg buffer and request Qt paintEvent.

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

flush_events()

Flush the GUI events for the figure.

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_default_filename()

Return a string, which includes extension, suitable for use as a default filename.

get_default_filetype()

Return the default savefig file format as specified in :rc:`savefig.format`.

get_supported_filetypes()

Return dict of savefig file formats supported by this backend.

get_supported_filetypes_grouped()

Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].

get_width_height(*[, physical])

Return the figure width and height in integral points or pixels.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

grab_mouse(ax)

Set the child ~.axes.Axes which is grabbing the mouse events.

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inaxes(xy)

Return the topmost visible ~.axes.Axes containing the point xy.

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

is_saving()

Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

load_figure(fig)

Load existing figure

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

manager_class

alias of FigureManagerQT

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseEventCoords([pos])

Calculate mouse coordinates in physical pixels.

mouseGrabber()

mouseLocation(event)

Get mouse location on axes for display

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

mpl_connect(s, func)

Bind function func to event s.

mpl_disconnect(cid)

Disconnect the callback with id cid.

nativeEvent(self, eventType, message)

nativeParentWidget(self)

new_manager(figure, num)

Create a new figure manager for figure, using this canvas class.

new_timer([interval, callbacks])

Create a new backend-specific subclass of .Timer.

nextInFocusChain(self)

normalGeometry(self)

notify_observers(event_name, *args, **kwargs)

Notify all registered observers of an event or property change.

objectName(self)

on_click(event)

Handle left/right clicks for distance calculation, polygons and profiles.

on_mouse_move(event)

Optional: handle dynamic feedback (e.g., while moving a polygon vertex).

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Copy the image from the Agg canvas to the qt.drawable.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

plot_line(p1, p2)

Plots line from distance calculation

plot_text(p1, p2)

Adds distance to plot and updates distance label

pos(self)

previousInFocusChain(self)

print_figure(*args, **kwargs)

Render the figure to hardcopy.

print_jpeg(filename_or_obj, *[, metadata, ...])

Write the figure to a JPEG file.

print_jpg(filename_or_obj, *[, metadata, ...])

Write the figure to a JPEG file.

print_png(filename_or_obj, *[, metadata, ...])

Write the figure to a PNG file.

print_tif(filename_or_obj, *[, metadata, ...])

Write the figure to a TIFF file.

print_tiff(filename_or_obj, *[, metadata, ...])

Write the figure to a TIFF file.

print_webp(filename_or_obj, *[, metadata, ...])

Write the figure to a WebP file.

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

release_mouse(ax)

Release the mouse grab held by the ~.axes.Axes ax.

removeAction(self, action)

removeEventFilter(self, a0)

remove_observer(event_name, callback)

Deregister a callback function from an event.

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

restore_view()

Restores the initial extent

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setCursorPosition()

Gets the cursor position on an MplCanvas

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_cursor(cursor)

Set the current cursor.

set_initial_extent()

Initial extent of the plot

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

start_event_loop([timeout])

Start a blocking event loop.

statusTip(self)

stop_event_loop([event])

Stop the current blocking event loop.

style(self)

styleSheet(self)

switch_backends(FigureCanvasClass)

[Deprecated] Instantiate an instance of FigureCanvasClass

tabletEvent(self, a0)

testAttribute(self, attribute)

textOnClick(event)

Adds text to plot at clicked position

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tostring_argb()

Get the image as ARGB bytes.

tostring_rgb()

[Deprecated] Get the image as RGB bytes.

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

copy_from_bbox

customContextMenuRequested

destroyed

disable_distance_mode

disable_tool

drawRectangle

enable_distance_mode

enable_tool

get_renderer

minumumSizeHint

objectNameChanged

print_raw

print_rgba

print_to_buffer

redraw_annotations

restore_region

toggle_tool

windowIconChanged

windowIconTextChanged

windowTitleChanged

calculate_distance(p1, p2)[source]#

Calculuates distance on a figure

Parameters:
  • p1 ([float]) – First endpoint

  • p2 ([float]) – Second endpoint

Returns:

Distance between two given points.

Return type:

float

property data#

Return the stored pandas DataFrame.

disable_distance_mode()[source]#
disable_tool(tool)[source]#
property distance#

when distance tool is active, the distance of the line

Type:

str

distanceOnClick(event)[source]#

Updates static endpoints of distance measuring line.

Updates the endpoint of the distance measuring line and calls methods that update the line and text. Updates MplCanvas.first_point if it is the start of the line and MplCanvas.line_saved and MplCanvas.dtext_saved if it is the end of the line.

Parameters:

event (MouseEvent) – Mouse click event.

distanceOnMove(event)[source]#

Updates dynamic second point of distance measuring line.

Updates the second endpoint of the distance measuring line and calls methods that update the line and text. Updates MplCanvas.line and MplCanvas.dtext.

Parameters:

event (MouseEvent) – Mouse click event.

distance_reset()[source]#

Resets distance variables and clears plot

Sets MplCanvas.first_point to None, MplCanvas.line and MplCanvas.dtext. If MainWindow.toolButtonDistance is not checked, then MainWindow.labelInfoDistance is also reset.

enable_distance_mode()[source]#
enable_tool(tool)[source]#
enterEvent(self, event: QEnterEvent | None)[source]#
leaveEvent(self, a0: QEvent | None)[source]#
load_figure(fig)[source]#

Load existing figure

Parameters:

fig (matplotlib.Figure) – Matplotlib figure.

mouseLocation(event)[source]#

Get mouse location on axes for display

Displays the location and value of a map in MainWindow.widgetPlotInfoSV.

Parameters:

event (event data) – Includes the location of mouse pointer.

on_click(event)[source]#

Handle left/right clicks for distance calculation, polygons and profiles.

on_mouse_move(event)[source]#

Optional: handle dynamic feedback (e.g., while moving a polygon vertex).

plot_line(p1, p2)[source]#

Plots line from distance calculation

Parameters:
  • p1 (tuple) – Endpoints of line.

  • p2 (tuple) – Endpoints of line.

Returns:

Handle to line

Return type:

matplotlib.plot

property plot_name#

Return the stored pandas DataFrame.

plot_text(p1, p2)[source]#

Adds distance to plot and updates distance label

Updates distance in MainWindow.labelInfoDistance and adds distance at the end of the measuring line.

Parameters:
  • p1 (tuple) – Endpoints of line.

  • p2 (tuple) – Endpoints of line.

Returns:

  • matplotlib.text – Handle to text.

  • text_dict (dict) – Dictionary needed to reconstruct distance label

redraw_annotations()[source]#
restore_view()[source]#

Restores the initial extent

Restores the initial extent when home signal is received.

Seealso:

toggle_tool

setCursorPosition()[source]#

Gets the cursor position on an MplCanvas

Mouse listener

set_initial_extent()[source]#

Initial extent of the plot

Sets the initital extent of the plot.

textOnClick(event)[source]#

Adds text to plot at clicked position

Only adds a text to a plot when the Annotate button is checked.

Parameters:

event (MouseEvent) – Mouse click event.

toggle_tool(tool, enable=None)[source]#
property value#

volue at mouse pointer location

Type:

str

property xpos#

x position of mouse pointer on canvas

Type:

str

property ypos#

y position of mouse pointer on canvas

Type:

str

class common.CustomMplCanvas.SimpleMplCanvas(sub=111, parent=None, width=5, height=4, proj=None)[source]#

Bases: FigureCanvasQTAgg

Matplotlib canvas object for non-interactive plots

Parameters:
  • sub (int, optional) – Subplot location, by default 111

  • parent (object, optional) – Parent calling MplCanvas, by default None

  • width (int, optional) – Width in inches, by default 5

  • height (int, optional) – Height in inches, by default 4

  • proj (str, optional) – Projection, by default None

Attributes:
button_pick_id
callbacks
device_pixel_ratio

The ratio of physical to logical pixels used for the canvas on screen.

fixed_dpi
scroll_pick_id

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blit([bbox])

Blit the canvas in bbox (default entire canvas).

blockSignals(self, b)

buffer_rgba()

Get the image as a memoryview to the renderer's buffer.

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

draw()

Render the figure, and queue a request for a Qt draw.

draw_idle()

Queue redraw of the Agg buffer and request Qt paintEvent.

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

flush_events()

Flush the GUI events for the figure.

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_default_filename()

Return a string, which includes extension, suitable for use as a default filename.

get_default_filetype()

Return the default savefig file format as specified in :rc:`savefig.format`.

get_supported_filetypes()

Return dict of savefig file formats supported by this backend.

get_supported_filetypes_grouped()

Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].

get_width_height(*[, physical])

Return the figure width and height in integral points or pixels.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

grab_mouse(ax)

Set the child ~.axes.Axes which is grabbing the mouse events.

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inaxes(xy)

Return the topmost visible ~.axes.Axes containing the point xy.

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

is_saving()

Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

manager_class

alias of FigureManagerQT

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseEventCoords([pos])

Calculate mouse coordinates in physical pixels.

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

mpl_connect(s, func)

Bind function func to event s.

mpl_disconnect(cid)

Disconnect the callback with id cid.

nativeEvent(self, eventType, message)

nativeParentWidget(self)

new_manager(figure, num)

Create a new figure manager for figure, using this canvas class.

new_timer([interval, callbacks])

Create a new backend-specific subclass of .Timer.

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Copy the image from the Agg canvas to the qt.drawable.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

print_figure(*args, **kwargs)

Render the figure to hardcopy.

print_jpeg(filename_or_obj, *[, metadata, ...])

Write the figure to a JPEG file.

print_jpg(filename_or_obj, *[, metadata, ...])

Write the figure to a JPEG file.

print_png(filename_or_obj, *[, metadata, ...])

Write the figure to a PNG file.

print_tif(filename_or_obj, *[, metadata, ...])

Write the figure to a TIFF file.

print_tiff(filename_or_obj, *[, metadata, ...])

Write the figure to a TIFF file.

print_webp(filename_or_obj, *[, metadata, ...])

Write the figure to a WebP file.

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

release_mouse(ax)

Release the mouse grab held by the ~.axes.Axes ax.

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_cursor(cursor)

Set the current cursor.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

start_event_loop([timeout])

Start a blocking event loop.

statusTip(self)

stop_event_loop([event])

Stop the current blocking event loop.

style(self)

styleSheet(self)

switch_backends(FigureCanvasClass)

[Deprecated] Instantiate an instance of FigureCanvasClass

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tostring_argb()

Get the image as ARGB bytes.

tostring_rgb()

[Deprecated] Get the image as RGB bytes.

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

copy_from_bbox

customContextMenuRequested

destroyed

drawRectangle

get_renderer

minumumSizeHint

objectNameChanged

print_raw

print_rgba

print_to_buffer

restore_region

windowIconChanged

windowIconTextChanged

windowTitleChanged

common.CustomWidgets module#

class common.CustomWidgets.ColorButton(permanent_text=None, ui=None, parent=None, initial_color=None)[source]#

Bases: QPushButton

A QPushButton subclass that allows the user to select a background color via a QColorDialog. The widget tracks a history of recently selected colors and emits a signal whenever the color changes.

Features: - Emits colorChanged(QColor) when the button’s color is updated. - Maintains a history of recently used colors for quick access. - Displays the selected color as the button background.

permanent_text#

Fixed text displayed on the button. If None, the button text shows the selected color’s hex code.

Type:

str or None

ui#

Reference to the parent UI component, used as the parent for the color dialog.

Type:

QWidget or None

_color_history#

Internal list tracking recently selected colors.

Type:

list of QColor

_max_history#

Maximum number of colors to keep in the history (default = 16).

Type:

int

Signals:

colorChanged(QColor) – Emitted when the button’s background color changes.

Parameters:
  • permanent_text (str or None) – Fixed text to display on the button. If None, the button text will display the color’s hex code.

  • ui (QWidget or None) – Parent UI component, used as the parent for the color dialog.

  • parent (QWidget or None) – Parent widget in the Qt hierarchy.

Example

btn = ColorButton(“Pick Color”) btn.colorChanged.connect(lambda c: print(“New color:”, c.name()))

Attributes:
color

QColor : Return the current background color of the button.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

animateClick(self)

autoDefault(self)

autoExclusive(self)

autoFillBackground(self)

autoRepeat(self)

autoRepeatDelay(self)

autoRepeatInterval(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, e)

checkStateSet(self)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

click(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, e)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

group(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

hitButton(self, pos)

icon(self)

iconSize(self)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isCheckable(self)

isChecked(self)

isDefault(self)

isDown(self)

isEnabled(self)

isEnabledTo(self, a0)

isFlat(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, e)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

menu(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, e)

mouseReleaseEvent(self, e)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextCheckState(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

select_color()

Open a QColorDialog to allow the user to select a color.

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoDefault(self, a0)

setAutoExclusive(self, a0)

setAutoFillBackground(self, enabled)

setAutoRepeat(self, a0)

setAutoRepeatDelay(self, a0)

setAutoRepeatInterval(self, a0)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCheckable(self, a0)

setChecked(self, a0)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDefault(self, a0)

setDisabled(self, a0)

setDown(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFlat(self, a0)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setIcon(self, icon)

setIconSize(self, size)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMenu(self, menu)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcut(self, key)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setText(self, text)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

shortcut(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMenu(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

text(self)

thread(self)

timerEvent(self, e)

toggle(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

clicked

colorChanged

customContextMenuRequested

destroyed

objectNameChanged

pressed

released

toggled

windowIconChanged

windowIconTextChanged

windowTitleChanged

property color#

Return the current background color of the button.

Type:

QColor

colorChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

select_color()[source]#

Open a QColorDialog to allow the user to select a color.

  • Initializes the dialog with the current color.

  • Populates the custom color slots with recent history.

  • Updates the button background and text when a new color is selected.

  • Emits colorChanged(QColor) if the color changes.

class common.CustomWidgets.CustomAction(text: str, light_icon_unchecked: str, light_icon_checked: str | None = None, dark_icon_unchecked: str | None = None, dark_icon_checked: str | None = None, parent=None)[source]#

Bases: QAction

An action that changes icons when checked or the theme changes from light to dark

self._light_icon_unchecked#

Icon for light, unchecked state

Type:

QIcon

self._light_icon_checked#

Icon for light, checked state

Type:

QIcon

self._dark_icon_unchecked#

Icon for dark, unchecked state

Type:

QIcon

self._dark_icon_checked#

Icon for dark, checked state

Type:

QIcon

self._current_theme#

“light” or “dark” color theme

Type:

str

Parameters:
  • text (str) – Text to display by widget

  • light_icon_unchecked (str) – Unchecked icon filename for light color theme.

  • light_icon_checked (str | None) – Checked icon filename for light color theme. If None, the icon is not checkable

  • dark_icon_unchecked (str) – Unchecked icon filename for dark color theme.

  • dark_icon_checked (str | None) – Checked icon filename for dark color theme. If None, the icon is not checkable

  • button_size (int) – Size of button in pt.

  • icon_size (int) – Size of icon on button in pt.

  • parent (QToolButton) – Tool button to set icons.

set_theme()[source]#

Updates light or dark theme icons

update_icon()[source]#

Update the icon based on the button’s checked state.

Methods

actionGroup(self)

activate(self, event)

associatedObjects(self)

autoRepeat(self)

blockSignals(self, b)

childEvent(self, a0)

children(self)

connectNotify(self, signal)

customEvent(self, a0)

data(self)

deleteLater(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, a0)

eventFilter(self, a0, a1)

findChild(-> QObjectT)

findChildren(...)

font(self)

hover(self)

icon(self)

iconText(self)

inherits(self, classname)

installEventFilter(self, a0)

isCheckable(self)

isChecked(self)

isEnabled(self)

isIconVisibleInMenu(self)

isQuickItemType(self)

isSeparator(self)

isShortcutVisibleInContextMenu(self)

isSignalConnected(self, signal)

isVisible(self)

isWidgetType(self)

isWindowType(self)

killTimer(self, id)

menu(self)

menuRole(self)

metaObject(self)

moveToThread(self, thread)

objectName(self)

parent(self)

priority(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, signal)

removeEventFilter(self, a0)

resetEnabled(self)

sender(self)

senderSignalIndex(self)

setActionGroup(self, group)

setAutoRepeat(self, a0)

setCheckable(self, a0)

setChecked(self, a0)

setData(self, var)

setDisabled(self, b)

setEnabled(self, a0)

setFont(self, font)

setIcon(self, icon)

setIconText(self, text)

setIconVisibleInMenu(self, visible)

setMenu(self, menu)

setMenuRole(self, menuRole)

setObjectName(self, name)

setParent(self, a0)

setPriority(self, priority)

setProperty(self, name, value)

setSeparator(self, b)

setShortcut(self, shortcut)

setShortcutContext(self, context)

setShortcutVisibleInContextMenu(self, show)

setShortcuts(setShortcuts)

setStatusTip(self, statusTip)

setText(self, text)

setToolTip(self, tip)

setVisible(self, a0)

setWhatsThis(self, what)

set_theme(theme)

Updates the icon to light/dark theme.

shortcut(self)

shortcutContext(self)

shortcuts(self)

showStatusText(self[, object])

signalsBlocked(self)

startTimer(self, interval[, timerType])

statusTip(self)

text(self)

thread(self)

timerEvent(self, a0)

toggle(self)

toolTip(self)

tr(sourceText[, disambiguation, n])

trigger(self)

update_icon()

Update the icon based on the button's checked state and theme.

whatsThis(self)

ActionEvent

MenuRole

Priority

changed

checkableChanged

destroyed

enabledChanged

hovered

objectNameChanged

toggled

triggered

visibleChanged

set_theme(theme: str)[source]#

Updates the icon to light/dark theme.

update_icon()[source]#

Update the icon based on the button’s checked state and theme.

class common.CustomWidgets.CustomActionMenu(text, menu_items, light_icon_unchecked: str, dark_icon_unchecked: str | None = None, parent=None)[source]#

Bases: CustomAction

A custom QMenu that allows dynamic addition and removal of menu lame_action.

items#

A dictionary mapping action names (as strings) to their corresponding QAction objects.

Type:

dict[str, QAction]

add_menu_item(name: str, callback: Callable, shortcut: str | None = None, tooltip: str | None = None) None[source]#

Add a single menu item with an optional shortcut and tooltip.

remove_menu_item(name: str) None[source]#

Remove a menu item by name if it exists.

_add_menu_items(items: list[tuple[str, Callable, str | None, str | None]]) None[source]#

Add multiple menu items in one batch operation.

clear_menu() None[source]#

Remove all existing menu actions from the menu and clear the internal items dictionary.

update_menu(items: list[tuple[str, Callable, str | None, str | None]]) None[source]#

Clear and rebuild the menu using the provided list of items.

get_menu_item(name: str) QAction | None#

Return the QAction associated with the given name, or None if not found.

get_menu_structure() nested list[source]#

Return current menu structure as a nested list.

has_submenu(name: str) bool[source]#

Check if a submenu by a specific name exists.

Parameters:
  • icon (str) – Path to the icon displayed in the action.

  • text (str) – Text label for the action.

  • menu_items (list) – Initial list of menu items and submenus to add.

  • parent (QWidget, optional) – Parent widget for the action and menu.

Methods

actionGroup(self)

activate(self, event)

add_menu_item(text, callback_or_submenu)

Adds a single menu item to the specified QMenu.

associatedObjects(self)

autoRepeat(self)

blockSignals(self, b)

childEvent(self, a0)

children(self)

clear_menu()

Clear all actions and submenus from the menu.

connectNotify(self, signal)

customEvent(self, a0)

data(self)

deleteLater(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, a0)

eventFilter(self, a0, a1)

findChild(-> QObjectT)

findChildren(...)

font(self)

get_menu_structure()

Return current menu structure as a nested list.

has_submenu(name)

Check if a submenu by a specific name exists.

hover(self)

icon(self)

iconText(self)

inherits(self, classname)

installEventFilter(self, a0)

isCheckable(self)

isChecked(self)

isEnabled(self)

isIconVisibleInMenu(self)

isQuickItemType(self)

isSeparator(self)

isShortcutVisibleInContextMenu(self)

isSignalConnected(self, signal)

isVisible(self)

isWidgetType(self)

isWindowType(self)

killTimer(self, id)

menu(self)

menuRole(self)

metaObject(self)

moveToThread(self, thread)

objectName(self)

parent(self)

priority(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, signal)

removeEventFilter(self, a0)

remove_menu_item(menu_path)

Remove a menu item or submenu by its path.

resetEnabled(self)

sender(self)

senderSignalIndex(self)

setActionGroup(self, group)

setAutoRepeat(self, a0)

setCheckable(self, a0)

setChecked(self, a0)

setData(self, var)

setDisabled(self, b)

setEnabled(self, a0)

setFont(self, font)

setIcon(self, icon)

setIconText(self, text)

setIconVisibleInMenu(self, visible)

setMenu(self, menu)

setMenuRole(self, menuRole)

setObjectName(self, name)

setParent(self, a0)

setPriority(self, priority)

setProperty(self, name, value)

setSeparator(self, b)

setShortcut(self, shortcut)

setShortcutContext(self, context)

setShortcutVisibleInContextMenu(self, show)

setShortcuts(setShortcuts)

setStatusTip(self, statusTip)

setText(self, text)

setToolTip(self, tip)

setVisible(self, a0)

setWhatsThis(self, what)

set_theme(theme)

Updates the icon to light/dark theme.

shortcut(self)

shortcutContext(self)

shortcuts(self)

showStatusText(self[, object])

signalsBlocked(self)

startTimer(self, interval[, timerType])

statusTip(self)

text(self)

thread(self)

timerEvent(self, a0)

toggle(self)

toolTip(self)

tr(sourceText[, disambiguation, n])

trigger(self)

update_icon()

Update the icon based on the button's checked state and theme.

update_menu(new_items)

Replace the entire menu with a new structure.

update_submenu(submenu_name, new_items)

Update a submenu with new items.

whatsThis(self)

ActionEvent

MenuRole

Priority

changed

checkableChanged

destroyed

enabledChanged

hovered

objectNameChanged

toggled

triggered

visibleChanged

add_menu_item(text, callback_or_submenu)[source]#

Adds a single menu item to the specified QMenu.

Parameters:
  • menu (QMenu) – The menu to which the item will be added.

  • label (str) – The text label for the menu item.

  • action (Callable | None) – The function to be called when the menu item is triggered. If None, the menu item will be added as a non-interactive (disabled) item.

Returns:

The QAction object that was added to the menu.

Return type:

QAction

Example

self.add_menu_item(file_menu, "Open", self.open_file)
self.add_menu_item(help_menu, "About", None)  # Adds a non-clickable item
clear_menu()[source]#

Clear all actions and submenus from the menu.

get_menu_structure()[source]#

Return current menu structure as a nested list.

This method is useful for debugging or serialization.

Returns:

Current menu structure.

Return type:

nested list

has_submenu(name)[source]#

Check if a submenu by a specific name exists.

Parameters:

name (str) – Submenu text to test

Returns:

True if name is a submenu

Return type:

bool

remove_menu_item(menu_path)[source]#

Remove a menu item or submenu by its path.

Parameters:

menu_path (list of str) – A list representing the hierarchical path to the item. For example, [‘Top Level’, ‘Submenu’, ‘Item Text’] will remove the action or submenu named ‘Item Text’ inside ‘Submenu’ which is under ‘Top Level’.

Returns:

True if the item was found and removed, False otherwise.

Return type:

bool

Examples

To remove ‘Export’ from the ‘File’ top level,

action.remove_menu_item(['File', 'Export'])
update_menu(new_items)[source]#

Replace the entire menu with a new structure.

Parameters:

new_items (list of tuples) –

A list where each tuple represents a menu item.

Each tuple must be of the form:

(str, Callable | list | None)

:param : :type : see also: _add_menu_items

update_submenu(submenu_name, new_items)[source]#

Update a submenu with new items.

Parameters:
  • submenu_name (str) – Name of submenu

  • new_items (items) –

    A list where each tuple represents a menu item.

    Each tuple must be of the form:

    (str, Callable | list | None)

:param : :type : see also: _add_menu_items

class common.CustomWidgets.CustomComboBox(popup_callback=None, *args, **kwargs)[source]#

Bases: QComboBox

A QComboBox subclass with support for dynamic item updates before showing the popup.

This custom combo box allows you to define a callback function that is executed each time the combo box is about to display its dropdown list. This is useful for updating the list of items dynamically based on application state.

popup_callback#

A function to be executed immediately before the popup is shown. Typically used to refresh or modify the items in the combo box.

Type:

callable or None

allItems() list[str][source]#

Returns a list of all item texts currently in the combo box.

showPopup()[source]#

Overrides the base class method to invoke the callback (if set) before showing the popup.

Parameters:
  • popup_callback (callable, optional) – A function that updates the combo box items before display. Default is None.

  • *args – Additional arguments passed to the QComboBox constructor.

  • **kwargs – Additional arguments passed to the QComboBox constructor.

Examples

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addItem(addItem)

addItems(self, texts)

adjustSize(self)

allItems()

Return a list of all item texts in the combobox.

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, e)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clear(self)

clearEditText(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

completer(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, e)

contextMenuPolicy(self)

count(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

currentData(self[, role])

currentIndex(self)

currentText(self)

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

duplicatesEnabled(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

findData(self, data[, role, flags])

findText(self, text[, flags])

focusInEvent(self, e)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, e)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasFrame(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, e)

hidePopup(self)

iconSize(self)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(-> Any)

insertAction(self, before, action)

insertActions(self, before, actions)

insertItem(insertItem)

insertItems(self, index, texts)

insertPolicy(self)

insertSeparator(self, index)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEditable(self)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

itemData(self, index[, role])

itemDelegate(self)

itemIcon(self, index)

itemText(self, index)

keyPressEvent(self, e)

keyReleaseEvent(self, e)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

lineEdit(self)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maxCount(self)

maxVisibleItems(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumContentsLength(self)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

model(self)

modelColumn(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, e)

mouseReleaseEvent(self, e)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, e)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

placeholderText(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

removeItem(self, index)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, e)

restoreGeometry(self, geometry)

rootModelIndex(self)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setActive(active)

Simplifies setting visibility and enabling of CustomComboBox

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCompleter(self, c)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCurrentIndex(self, index)

setCurrentText(self, text)

setCursor(self, a0)

setDisabled(self, a0)

setDuplicatesEnabled(self, enable)

setEditText(self, text)

setEditable(self, editable)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrame(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setIconSize(self, size)

setInputMethodHints(self, hints)

setInsertPolicy(self, policy)

setItemData(self, index, value[, role])

setItemDelegate(self, delegate)

setItemIcon(self, index, icon)

setItemText(self, index, text)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLineEdit(self, edit)

setLocale(self, locale)

setMask(setMask)

setMaxCount(self, max)

setMaxVisibleItems(self, maxItems)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumContentsLength(self, characters)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModel(self, model)

setModelColumn(self, visibleColumn)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setPlaceholderText(self, placeholderText)

setProperty(self, name, value)

setRootModelIndex(self, index)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeAdjustPolicy(self, policy)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setValidator(self, v)

setView(self, itemView)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, e)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

showPopup()

Executes the popup callback (if any) before showing the dropdown list.

signalsBlocked(self)

size(self)

sizeAdjustPolicy(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

validator(self)

view(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, e)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

InsertPolicy

PaintDeviceMetric

RenderFlag

SizeAdjustPolicy

activated

currentIndexChanged

currentTextChanged

customContextMenuRequested

destroyed

editTextChanged

highlighted

objectNameChanged

textActivated

textHighlighted

windowIconChanged

windowIconTextChanged

windowTitleChanged

allItems()[source]#

Return a list of all item texts in the combobox.

setActive(active: bool)[source]#

Simplifies setting visibility and enabling of CustomComboBox

Parameters:

active (bool) – Sets the state of visibility and enabling of widget

showPopup()[source]#

Executes the popup callback (if any) before showing the dropdown list.

Overrides the QComboBox method to inject behavior that updates the combobox contents just before it is shown to the user.

class common.CustomWidgets.CustomDockWidget(parent=None, *args, **kwargs)[source]#

Bases: QDockWidget

A custom QDockWidget that hides instead of closing when the user clicks the close button.

This subclass of QDockWidget overrides the standard close behavior so that the widget is simply hidden rather than destroyed. This allows the widget to be shown again later without needing to be re-instantiated.

Parameters:

parent (QWidget, optional) – The parent widget, typically a QMainWindow. Default is None.

closeEvent(event: QEvent)[source]#

Hides the dock instead of closing it when the user clicks the close button.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

allowedAreas(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Override the default close event to hide the dock widget instead of closing it.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

features(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAreaAllowed(self, area)

isEnabled(self)

isEnabledTo(self, a0)

isFloating(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, event)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllowedAreas(self, areas)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFeatures(self, features)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFloating(self, floating)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTitleBarWidget(self, widget)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWidget(self, widget)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

titleBarWidget(self)

toggleViewAction(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockWidgetFeature

PaintDeviceMetric

RenderFlag

allowedAreasChanged

customContextMenuRequested

destroyed

dockLocationChanged

featuresChanged

objectNameChanged

topLevelChanged

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

closeEvent(event)[source]#

Override the default close event to hide the dock widget instead of closing it.

This prevents the widget from being destroyed and allows it to be shown again later via widget.show().

Parameters:

event (QEvent) – The close event triggered by the user action.

class common.CustomWidgets.CustomLineEdit(parent=None, value=0.0, precision=4, threshold=10000.0, toward=None, validator=<PyQt6.QtGui.QDoubleValidator object>)[source]#

Bases: QLineEdit

Custom line edit widget, when the only input should be of type float

Adds additional functionality to QLineEdit by installing a validator and methods for limiting the precision of the displayed value in the UI. Note that full precision of the value is stored in self.value, only a ‘pretty’ number is displayed.

Parameters:
  • parent (_type_, optional) – _description_, by default None

  • value (float, optional) – _description_, by default 0.0

  • precision (int, optional) – _description_, by default 4

  • threshold (_type_, optional) – _description_, by default 1e4

  • toward (int, optional) – _description_, by default None

  • validator (QValidator, optional) – Provide a validator to automatically text inputs for appropriate type and ranges, by default QDoubleValidator

Attributes:
precision

int: The number of significant digits to display in the line edit.

threshold

float: Threshold above which scientific notation is used.

toward

int | float | None: Determines rounding direction in formatting.

value

float: The current internal numeric value stored in the widget.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(-> None)

addActions(self, actions)

adjustSize(self)

alignment(self)

autoFillBackground(self)

backgroundRole(self)

backspace(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clear(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

completer(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

copy(self)

create(self[, window, initializeWindow, ...])

createStandardContextMenu(self)

createWindowContainer(window[, parent, flags])

cursor(self)

cursorBackward(self, mark[, steps])

cursorForward(self, mark[, steps])

cursorMoveStyle(self)

cursorPosition(self)

cursorPositionAt(self, pos)

cursorRect(self)

cursorWordBackward(self, mark)

cursorWordForward(self, mark)

customEvent(self, a0)

cut(self)

del_(self)

deleteLater(self)

depth(self)

deselect(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

displayText(self)

dragEnabled(self)

dragEnterEvent(self, a0)

dragLeaveEvent(self, e)

dragMoveEvent(self, e)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

echoMode(self)

effectiveWinId(self)

end(self, mark)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasAcceptableInput(self)

hasFocus(self)

hasFrame(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasSelectedText(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

home(self, mark)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMask(self)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(-> Any)

insert(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isClearButtonEnabled(self)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isModified(self)

isQuickItemType(self)

isReadOnly(self)

isRedoAvailable(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isUndoAvailable(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maxLength(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

paste(self)

physicalDpiX(self)

physicalDpiY(self)

placeholderText(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

redo(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

selectAll(self)

selectedText(self)

selectionEnd(self)

selectionLength(self)

selectionStart(self)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAlignment(self, flag)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setClearButtonEnabled(self, enable)

setCompleter(self, completer)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setCursorMoveStyle(self, style)

setCursorPosition(self, a0)

setDisabled(self, a0)

setDragEnabled(self, b)

setEchoMode(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrame(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMask(self, inputMask)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaxLength(self, a0)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModified(self, a0)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setPlaceholderText(self, a0)

setProperty(self, name, value)

setReadOnly(self, a0)

setScreen(self, a0)

setSelection(self, a0, a1)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setText(self, a0)

setTextMargins(setTextMargins)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setValidator(self, a0)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_bounds([lower, upper])

Set optional lower and upper bounds for the value.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

text(self)

textMargins(self)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

undo(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

validator(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

ActionPosition

EchoMode

PaintDeviceMetric

RenderFlag

cursorPositionChanged

customContextMenuRequested

destroyed

editingFinished

inputRejected

objectNameChanged

returnPressed

selectionChanged

textChanged

textEdited

windowIconChanged

windowIconTextChanged

windowTitleChanged

property precision#

The number of significant digits to display in the line edit.

Type:

int

set_bounds(lower=None, upper=None)[source]#

Set optional lower and upper bounds for the value.

property threshold#

Threshold above which scientific notation is used.

Type:

float

property toward#

Determines rounding direction in formatting.

  • 0 = round toward zero

  • 1 = round away from zero

  • None = standard rounding

Type:

int | float | None

property value#

The current internal numeric value stored in the widget.

Type:

float

class common.CustomWidgets.CustomPage(obj_name: str = None, layout_cls=<class 'PyQt6.QtWidgets.QVBoxLayout'>, layout_args=None, scrollable=True, parent=None)[source]#

Bases: QWidget

A QWidget that contains a QScrollArea with a single content widget and layout. Simplifies putting scrollable pages into QToolBox, QTabWidget, QDockWidget, etc.

Parameters:
  • layout_cls (QVBoxLayout | QHBoxLayout | QGridLayout | QFormLayout) – Layout class for the inner content, by default QVBoxLayout

  • layout_args (dict) – Dictionary of kwargs to pass to the layout constructor

  • scrollable (bool) – If False, skips the scroll area and uses the content directly, by default True

Attributes:
content_layout
content_widget

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addItem(item)

Convenience to add a child item to the inner layout.

addLayout(layout)

Convenience to add a child layout to the inner layout.

addWidget(widget)

Convenience to add a child widget to the inner layout.

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

setSpacing

windowIconChanged

windowIconTextChanged

windowTitleChanged

addItem(item)[source]#

Convenience to add a child item to the inner layout.

addLayout(layout)[source]#

Convenience to add a child layout to the inner layout.

addWidget(widget)[source]#

Convenience to add a child widget to the inner layout.

property content_layout: QLayout#
property content_widget#
setContentsMargins(self, left: int, top: int, right: int, bottom: int) setContentsMargins(self, margins: QMargins)[source]#
setContentsMargins(self, margins: QMargins) None
setSpacing(spacing)[source]#
class common.CustomWidgets.CustomSlider(min_value=0, max_value=100, step=1, initial_value=50, precision=1, orientation='horizontal', label_position='low', parent=None)[source]#

Bases: QWidget

A custom slider widget that combines a horizontal QSlider and a QLabel.

This widget displays the current slider value in a label and emits custom signals for common slider events. It supports setting initial value, range, and step size.

Parameters:
  • min_value (float, optional) – Minimum value of the slider range (default is 0).

  • max_value (float, optional) – Maximum value of the slider range (default is 100).

  • step (float, optional) – Increment between values (default is 1).

  • initial_value (float, optional) – Initial slider value (default is 50).

  • parent (QWidget, optional) – Parent widget (default is None).

Signals:
  • valueChanged(int) – Emitted when the slider’s value changes.

  • sliderMoved(int) – Emitted while the slider is being dragged.

  • sliderReleased(int) – Emitted when the slider handle is released.

  • sliderPressed(int) – Emitted when the slider handle is pressed.

Attributes:
max_value
min_value
step

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

handle_label_change()

Updates the slider value from the label after editing is finished.

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setValue(float_value)

Sets the slider value.

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_label(int_value)

Updates the label value to display the slider's value.

updatesEnabled(self)

value()

Returns the current value of the slider.

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

setTickInterval

sliderMoved

sliderPressed

sliderReleased

valueChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

handle_label_change()[source]#

Updates the slider value from the label after editing is finished.

property max_value#
property min_value#
setTickInterval(new_interval)[source]#
setValue(float_value)[source]#

Sets the slider value.

Parameters:

value (int) – Desired slider value.

sliderMoved#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sliderPressed#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sliderReleased#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

property step#
update_label(int_value)[source]#

Updates the label value to display the slider’s value.

Parameters:

value (int) – Current value of the slider.

value()[source]#

Returns the current value of the slider.

Returns:

Current slider value.

Return type:

int

valueChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

class common.CustomWidgets.CustomTableWidget(parent=None)[source]#

Bases: QTableWidget

A QTableWidget subclass with extended utility functions for data extraction and conversion.

This widget supports conversion of table contents (including embedded widgets such as QLineEdit, QComboBox, QCheckBox, etc.) to a pandas DataFrame, and provides convenience methods for column-based data access. It is designed for integration with tools that dynamically populate cells with interactive widgets.

Examples

>>> widget = CustomTableWidget()
>>> widget.to_dataframe()
>>> widget.column_to_list(0)
>>> widget.column_to_list("Sample Name")

Notes

  • Embedded widgets are interpreted based on their type (e.g., QLineEdit.text(), QCheckBox.isChecked()).

  • Additional widget types can be handled by extending extract_widget_data().

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addScrollBarWidget(self, widget, alignment)

adjustSize(self)

alternatingRowColors(self)

autoFillBackground(self)

autoScrollMargin(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

cellWidget(self, row, column)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clear(self)

clearContents(self)

clearFocus(self)

clearMask(self)

clearSelection(self)

clearSpans(self)

close(self)

closeEditor(self, editor, hint)

closeEvent(self, a0)

closePersistentEditor(self, item)

colorCount(self)

column(self, item)

columnAt(self, x)

columnCount(self)

columnCountChanged(self, oldCount, newCount)

columnMoved(self, column, oldIndex, newIndex)

columnResized(self, column, oldWidth, newWidth)

columnSpan(self, row, column)

columnViewportPosition(self, column)

columnWidth(self, column)

column_to_list(column)

Extracts data from a specified column into a list.

commitData(self, editor)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

cornerWidget(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

currentChanged(self, current, previous)

currentColumn(self)

currentIndex(self)

currentItem(self)

currentRow(self)

cursor(self)

customEvent(self, a0)

dataChanged(self, topLeft, bottomRight[, roles])

defaultDropAction(self)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

dirtyRegionOffset(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragDropMode(self)

dragDropOverwriteMode(self)

dragEnabled(self)

dragEnterEvent(self, e)

dragLeaveEvent(self, e)

dragMoveEvent(self, e)

drawFrame(self, a0)

dropEvent(self, event)

dropIndicatorPosition(self)

dropMimeData(self, row, column, data, action)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

edit()

editItem(self, item)

editTriggers(self)

editorDestroyed(self, editor)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, e)

eventFilter(self, object, event)

executeDelayedItemsLayout(self)

extract_widget_data(widget)

Extracts relevant data from a widget embedded in the table.

find(a0)

findChild(-> QObjectT)

findChildren(...)

findItems(self, text, flags)

focusInEvent(self, e)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, e)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameRect(self)

frameShadow(self)

frameShape(self)

frameSize(self)

frameStyle(self)

frameWidth(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

gridStyle(self)

hasAutoScroll(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideColumn(self, column)

hideEvent(self, a0)

hideRow(self, row)

horizontalHeader(self)

horizontalHeaderItem(self, column)

horizontalOffset(self)

horizontalScrollBar(self)

horizontalScrollBarPolicy(self)

horizontalScrollMode(self)

horizontalScrollbarAction(self, action)

horizontalScrollbarValueChanged(self, value)

iconSize(self)

indexAt(self, p)

indexFromItem(self, item)

indexWidget(self, index)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

initViewItemOption(self, option)

inputMethodEvent(self, event)

inputMethodHints(self)

inputMethodQuery(self, query)

insertAction(self, before, action)

insertActions(self, before, actions)

insertColumn(self, column)

insertRow(self, row)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isColumnHidden(self, column)

isCornerButtonEnabled(self)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isIndexHidden(self, index)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isPersistentEditorOpen(self, item)

isQuickItemType(self)

isRightToLeft(self)

isRowHidden(self, row)

isSignalConnected(self, signal)

isSortingEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

item(self, row, column)

itemAt(-> Optional[QTableWidgetItem])

itemDelegate(self)

itemDelegateForColumn(self, column)

itemDelegateForIndex(self, index)

itemDelegateForRow(self, row)

itemFromIndex(self, index)

itemPrototype(self)

items(self, data)

keyPressEvent(self, e)

keyReleaseEvent(self, a0)

keyboardGrabber()

keyboardSearch(self, search)

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

lineWidth(self)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumViewportSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

midLineWidth(self)

mimeData(self, items)

mimeTypes(self)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

model(self)

mouseDoubleClickEvent(self, e)

mouseGrabber()

mouseMoveEvent(self, e)

mousePressEvent(self, e)

mouseReleaseEvent(self, e)

move(move)

moveCursor(self, cursorAction, modifiers)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

openPersistentEditor(self, item)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, e)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeCellWidget(self, arow, acolumn)

removeColumn(self, column)

removeEventFilter(self, a0)

removeRow(self, row)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

reset(self)

resetHorizontalScrollMode(self)

resetVerticalScrollMode(self)

resize(resize)

resizeColumnToContents(self, column)

resizeColumnsToContents(self)

resizeEvent(self, e)

resizeRowToContents(self, row)

resizeRowsToContents(self)

restoreGeometry(self, geometry)

rootIndex(self)

row(self, item)

rowAt(self, y)

rowCount(self)

rowCountChanged(self, oldCount, newCount)

rowHeight(self, row)

rowMoved(self, row, oldIndex, newIndex)

rowResized(self, row, oldHeight, newHeight)

rowSpan(self, row, column)

rowViewportPosition(self, row)

rowsAboutToBeRemoved(self, parent, start, end)

rowsInserted(self, parent, start, end)

saveGeometry(self)

scheduleDelayedItemsLayout(self)

screen(self)

scroll(scroll)

scrollBarWidgets(self, alignment)

scrollContentsBy(self, dx, dy)

scrollDirtyRegion(self, dx, dy)

scrollTo(self, index[, hint])

scrollToBottom(self)

scrollToItem(self, item[, hint])

scrollToTop(self)

selectAll(self)

selectColumn(self, column)

selectRow(self, row)

selectedIndexes(self)

selectedItems(self)

selectedRanges(self)

selectionBehavior(self)

selectionChanged(self, selected, deselected)

selectionCommand(self, index[, event])

selectionMode(self)

selectionModel(self)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAlternatingRowColors(self, enable)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setAutoScroll(self, enable)

setAutoScrollMargin(self, margin)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCellWidget(self, row, column, widget)

setColumnCount(self, columns)

setColumnHidden(self, column, hide)

setColumnWidth(self, column, width)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCornerButtonEnabled(self, enable)

setCornerWidget(self, widget)

setCurrentCell(setCurrentCell)

setCurrentIndex(self, index)

setCurrentItem(setCurrentItem)

setCursor(self, a0)

setDefaultDropAction(self, dropAction)

setDirtyRegion(self, region)

setDisabled(self, a0)

setDragDropMode(self, behavior)

setDragDropOverwriteMode(self, overwrite)

setDragEnabled(self, enable)

setDropIndicatorShown(self, enable)

setEditTriggers(self, triggers)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrameRect(self, a0)

setFrameShadow(self, a0)

setFrameShape(self, a0)

setFrameStyle(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setGridStyle(self, style)

setHidden(self, hidden)

setHorizontalHeader(self, header)

setHorizontalHeaderItem(self, column, item)

setHorizontalHeaderLabels(self, labels)

setHorizontalScrollBar(self, scrollbar)

setHorizontalScrollBarPolicy(self, a0)

setHorizontalScrollMode(self, mode)

setIconSize(self, size)

setIndexWidget(self, index, widget)

setInputMethodHints(self, hints)

setItem(self, row, column, item)

setItemDelegate(self, delegate)

setItemDelegateForColumn(self, column, delegate)

setItemDelegateForRow(self, row, delegate)

setItemPrototype(self, item)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLineWidth(self, a0)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMidLineWidth(self, a0)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModel(self, model)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setRangeSelected(self, range, select)

setRootIndex(self, index)

setRowCount(self, rows)

setRowHeight(self, row, height)

setRowHidden(self, row, hide)

setScreen(self, a0)

setSelection(self, rect, command)

setSelectionBehavior(self, behavior)

setSelectionMode(self, mode)

setSelectionModel(self, selectionModel)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setShowGrid(self, show)

setSizeAdjustPolicy(self, policy)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setSortingEnabled(self, enable)

setSpan(self, row, column, rowSpan, columnSpan)

setState(self, state)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabKeyNavigation(self, enable)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTextElideMode(self, mode)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVerticalHeader(self, header)

setVerticalHeaderItem(self, row, item)

setVerticalHeaderLabels(self, labels)

setVerticalScrollBar(self, scrollbar)

setVerticalScrollBarPolicy(self, a0)

setVerticalScrollMode(self, mode)

setViewport(self, widget)

setViewportMargins(setViewportMargins)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

setWordWrap(self, on)

setupViewport(self, viewport)

sharedPainter(self)

show(self)

showColumn(self, column)

showDropIndicator(self)

showEvent(self, a0)

showFullScreen(self)

showGrid(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

showRow(self, row)

signalsBlocked(self)

size(self)

sizeAdjustPolicy(self)

sizeHint(self)

sizeHintForColumn(self, column)

sizeHintForIndex(self, index)

sizeHintForRow(self, row)

sizeIncrement(self)

sizePolicy(self)

sortByColumn(self, column, order)

sortItems(self, column[, order])

stackUnder(self, a0)

startDrag(self, supportedActions)

startTimer(self, interval[, timerType])

state(self)

statusTip(self)

style(self)

styleSheet(self)

supportedDropActions(self)

tabKeyNavigation(self)

tabletEvent(self, a0)

takeHorizontalHeaderItem(self, column)

takeItem(self, row, column)

takeVerticalHeaderItem(self, row)

testAttribute(self, attribute)

textElideMode(self)

thread(self)

timerEvent(self, event)

to_dataframe()

Converts the table content (including widgets) to a pandas DataFrame.

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update)

updateEditorData(self)

updateEditorGeometries(self)

updateGeometries(self)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

verticalHeader(self)

verticalHeaderItem(self, row)

verticalOffset(self)

verticalScrollBar(self)

verticalScrollBarPolicy(self)

verticalScrollMode(self)

verticalScrollbarAction(self, action)

verticalScrollbarValueChanged(self, value)

viewport(self)

viewportEvent(self, e)

viewportMargins(self)

viewportSizeHint(self)

visibleRegion(self)

visualColumn(self, logicalColumn)

visualItemRect(self, item)

visualRect(self, index)

visualRegionForSelection(self, selection)

visualRow(self, logicalRow)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

wordWrap(self)

x(self)

y(self)

CursorAction

DragDropMode

DropIndicatorPosition

EditTrigger

PaintDeviceMetric

RenderFlag

ScrollHint

ScrollMode

SelectionBehavior

SelectionMode

Shadow

Shape

SizeAdjustPolicy

State

StyleMask

activated

cellActivated

cellChanged

cellClicked

cellDoubleClicked

cellEntered

cellPressed

clicked

currentCellChanged

currentItemChanged

customContextMenuRequested

destroyed

doubleClicked

entered

iconSizeChanged

itemActivated

itemChanged

itemClicked

itemDoubleClicked

itemEntered

itemPressed

itemSelectionChanged

objectNameChanged

pressed

viewportEntered

windowIconChanged

windowIconTextChanged

windowTitleChanged

column_to_list(column)[source]#

Extracts data from a specified column into a list.

Parameters:

column (int or str) – Column index (int) or column header name (str).

Returns:

A list of cell values from the specified column.

Return type:

list

Raises:

ValueError – If the specified column name or index is not found.

extract_widget_data(widget: QWidget)[source]#

Extracts relevant data from a widget embedded in the table.

This method is used to obtain the appropriate value representation of a widget for export (e.g., into a DataFrame).

Parameters:

widget (QWidget) – A widget stored in a table cell.

Returns:

The value extracted from the widget, depending on its type.

Return type:

str or bool or float or None

to_dataframe() DataFrame[source]#

Converts the table content (including widgets) to a pandas DataFrame.

Returns:

A DataFrame with rows and columns matching the table content.

Return type:

pd.DataFrame

class common.CustomWidgets.CustomToolBox(parent=None)[source]#

Bases: QToolBox

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addItem(-> int)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

count(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

currentIndex(self)

currentWidget(self)

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

drawFrame(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, e)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameRect(self)

frameShadow(self)

frameShape(self)

frameSize(self)

frameStyle(self)

frameWidth(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

indexOf(self, widget)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

insertItem(-> int)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isItemEnabled(self, index)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

itemIcon(self, index)

itemInserted(self, index)

itemRemoved(self, index)

itemText(self, index)

itemToolTip(self, index)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

lineWidth(self)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

midLineWidth(self)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

removeItem(self, index)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCurrentIndex(self, index)

setCurrentWidget(self, widget)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrameRect(self, a0)

setFrameShadow(self, a0)

setFrameShape(self, a0)

setFrameStyle(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setItemEnabled(self, index, enabled)

setItemIcon(self, index, icon)

setItemText(self, index, text)

setItemToolTip(self, index, toolTip)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLineWidth(self, a0)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMidLineWidth(self, a0)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_page_icons(page_text, light_icon, dark_icon)

Assign icons for a given page.

set_theme(theme)

Set current theme and update all icons.

sharedPainter(self)

show(self)

showEvent(self, e)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_icon(page_text)

Update a single page icon based on current theme.

update_icons()

Update all page icons to match the current theme.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self, index)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

Shadow

Shape

StyleMask

currentChanged

customContextMenuRequested

destroyed

objectNameChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

set_page_icons(page_text: str, light_icon: Path, dark_icon: Path)[source]#

Assign icons for a given page.

set_theme(theme: str)[source]#

Set current theme and update all icons.

update_icon(page_text: str)[source]#

Update a single page icon based on current theme.

update_icons()[source]#

Update all page icons to match the current theme.

class common.CustomWidgets.CustomToolButton(text: str, light_icon_unchecked: str, light_icon_checked: str | None = None, dark_icon_unchecked: str | None = None, dark_icon_checked: str | None = None, button_size: int = 32, icon_size: int = 26, parent=None)[source]#

Bases: QToolButton

A button that changes icons when checked or the theme changes from light to dark

self._light_icon_unchecked#

Icon for light, unchecked state

Type:

QIcon

self._light_icon_checked#

Icon for light, checked state

Type:

QIcon

self._dark_icon_unchecked#

Icon for dark, unchecked state

Type:

QIcon

self._dark_icon_checked#

Icon for dark, checked state

Type:

QIcon

self._current_theme#

“light” or “dark” color theme

Type:

str

Parameters:
  • light_icon_unchecked (str) – Unchecked icon filename for light color theme.

  • light_icon_checked (str | None) – Checked icon filename for light color theme. If None, the icon is not checkable

  • dark_icon_unchecked (str) – Unchecked icon filename for dark color theme.

  • dark_icon_checked (str | None) – Checked icon filename for dark color theme. If None, the icon is not checkable

  • button_size (int) – Size of button in pt.

  • icon_size (int) – Size of icon on button in pt.

  • parent (QToolButton) – Tool button to set icons.

set_theme()[source]#

Updates light or dark theme icons

update_icon()[source]#

Update the icon based on the button’s checked state.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

animateClick(self)

arrowType(self)

autoExclusive(self)

autoFillBackground(self)

autoRaise(self)

autoRepeat(self)

autoRepeatDelay(self)

autoRepeatInterval(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

checkStateSet(self)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

click(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

defaultAction(self)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, a0)

event(self, e)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, e)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, e)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

group(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

hitButton(self, pos)

icon(self)

iconSize(self)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isCheckable(self)

isChecked(self)

isDown(self)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, e)

keyReleaseEvent(self, e)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

menu(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, e)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextCheckState(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

popupMode(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setArrowType(self, type)

setAttribute(self, attribute[, on])

setAutoExclusive(self, a0)

setAutoFillBackground(self, enabled)

setAutoRaise(self, enable)

setAutoRepeat(self, a0)

setAutoRepeatDelay(self, a0)

setAutoRepeatInterval(self, a0)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCheckable(self, a0)

setChecked(self, a0)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDefaultAction(self, a0)

setDisabled(self, a0)

setDown(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setIcon(self, icon)

setIconSize(self, size)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMenu(self, menu)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setPopupMode(self, mode)

setProperty(self, name, value)

setScreen(self, a0)

setShortcut(self, key)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setText(self, text)

setToolButtonStyle(self, style)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_theme(theme)

Updates the icon to light/dark theme.

sharedPainter(self)

shortcut(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMenu(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

text(self)

thread(self)

timerEvent(self, a0)

toggle(self)

toolButtonStyle(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_icon()

Update the icon based on the button's checked state and theme.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

ToolButtonPopupMode

clicked

customContextMenuRequested

destroyed

objectNameChanged

pressed

released

toggled

triggered

windowIconChanged

windowIconTextChanged

windowTitleChanged

set_theme(theme: str)[source]#

Updates the icon to light/dark theme.

update_icon()[source]#

Update the icon based on the button’s checked state and theme.

class common.CustomWidgets.CustomTreeView(parent=None)[source]#

Bases: QTreeView

A customized QTreeView widget for managing a hierarchical tree structure.

Provides functionality to create branches and leaves in a QStandardItemModel-based tree, search for items, retrieve paths and associated data, sort branches, and handle UI events.

treeModel#

The data model used for the tree.

Type:

QStandardItemModel

root_node#

The invisible root node of the tree model.

Type:

QStandardItem

Parameters:

parent (QWidget, optional) – The parent widget, by default None.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addScrollBarWidget(self, widget, alignment)

add_branch(parent_item, branch_name[, data])

Add a new branch to the tree under the specified parent.

add_leaf(branch_item, leaf_name[, data])

Add a new leaf to a branch.

adjustSize(self)

allColumnsShowFocus(self)

alternatingRowColors(self)

autoExpandDelay(self)

autoFillBackground(self)

autoScrollMargin(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

branch_exists(parent_item, branch_name)

Check if a branch with a given name exists under the specified parent item.

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

clearSelection(self)

clear_tree()

Clears all items from the tree model.

close(self)

closeEditor(self, editor, hint)

closeEvent(self, a0)

closePersistentEditor(self, index)

collapse(self, index)

collapseAll(self)

colorCount(self)

columnAt(self, x)

columnCountChanged(self, oldCount, newCount)

columnMoved(self)

columnResized(self, column, oldSize, newSize)

columnViewportPosition(self, column)

columnWidth(self, column)

commitData(self, editor)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

cornerWidget(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

currentChanged(self, current, previous)

currentIndex(self)

cursor(self)

customEvent(self, a0)

dataChanged(self, topLeft, bottomRight[, roles])

defaultDropAction(self)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

dirtyRegionOffset(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragDropMode(self)

dragDropOverwriteMode(self)

dragEnabled(self)

dragEnterEvent(self, e)

dragLeaveEvent(self, e)

dragMoveEvent(self, event)

drawBranches(self, painter, rect, index)

drawFrame(self, a0)

drawRow(self, painter, options, index)

drawTree(self, painter, region)

dropEvent(self, e)

dropIndicatorPosition(self)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

edit()

editTriggers(self)

editorDestroyed(self, editor)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, object, event)

executeDelayedItemsLayout(self)

expand(self, index)

expandAll(self)

expandRecursively(self, index[, depth])

expandToDepth(self, depth)

expandsOnDoubleClick(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

find_leaf(branch_item, leaf_name)

Find a leaf under a branch by its name.

focusInEvent(self, e)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, e)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameRect(self)

frameShadow(self)

frameShape(self)

frameSize(self)

frameStyle(self)

frameWidth(self)

geometry(self)

get_item_path(item)

Return the full path of an item as a list from root to the given item.

get_leaf_data(leaf_item)

Return the full path of an item as a list from root to the given item.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasAutoScroll(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

header(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideColumn(self, column)

hideEvent(self, a0)

horizontalOffset(self)

horizontalScrollBar(self)

horizontalScrollBarPolicy(self)

horizontalScrollMode(self)

horizontalScrollbarAction(self, action)

horizontalScrollbarValueChanged(self, value)

iconSize(self)

indentation(self)

indexAbove(self, index)

indexAt(self, p)

indexBelow(self, index)

indexRowSizeHint(self, index)

indexWidget(self, index)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

initViewItemOption(self, option)

inputMethodEvent(self, event)

inputMethodHints(self)

inputMethodQuery(self, query)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAnimated(self)

isColumnHidden(self, column)

isEnabled(self)

isEnabledTo(self, a0)

isExpanded(self, index)

isFirstColumnSpanned(self, row, parent)

isFullScreen(self)

isHeaderHidden(self)

isHidden(self)

isIndexHidden(self, index)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isPersistentEditorOpen(self, index)

isQuickItemType(self)

isRightToLeft(self)

isRowHidden(self, row, parent)

isSignalConnected(self, signal)

isSortingEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

itemDelegate(self)

itemDelegateForColumn(self, column)

itemDelegateForIndex(self, index)

itemDelegateForRow(self, row)

itemsExpandable(self)

keyPressEvent(self, event)

keyReleaseEvent(self, a0)

keyboardGrabber()

keyboardSearch(self, search)

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

lineWidth(self)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumViewportSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

midLineWidth(self)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

model(self)

mouseDoubleClickEvent(self, e)

mouseGrabber()

mouseMoveEvent(self, event)

mousePressEvent(self, e)

mouseReleaseEvent(self, event)

move(move)

moveCursor(self, cursorAction, modifiers)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

on_double_click(index)

Handle a double-click event on an item in the tree.

openPersistentEditor(self, index)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, e)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

reexpand(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

reset(self)

resetHorizontalScrollMode(self)

resetIndentation(self)

resetVerticalScrollMode(self)

resize(resize)

resizeColumnToContents(self, column)

resizeEvent(self, e)

restoreGeometry(self, geometry)

rootIndex(self)

rootIsDecorated(self)

rowHeight(self, index)

rowsAboutToBeRemoved(self, parent, start, end)

rowsInserted(self, parent, start, end)

rowsRemoved(self, parent, first, last)

saveGeometry(self)

scheduleDelayedItemsLayout(self)

screen(self)

scroll(scroll)

scrollBarWidgets(self, alignment)

scrollContentsBy(self, dx, dy)

scrollDirtyRegion(self, dx, dy)

scrollTo(self, index[, hint])

scrollToBottom(self)

scrollToTop(self)

selectAll(self)

selectedIndexes(self)

selectionBehavior(self)

selectionChanged(self, selected, deselected)

selectionCommand(self, index[, event])

selectionMode(self)

selectionModel(self)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllColumnsShowFocus(self, enable)

setAlternatingRowColors(self, enable)

setAnimated(self, enable)

setAttribute(self, attribute[, on])

setAutoExpandDelay(self, delay)

setAutoFillBackground(self, enabled)

setAutoScroll(self, enable)

setAutoScrollMargin(self, margin)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setColumnHidden(self, column, hide)

setColumnWidth(self, column, width)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCornerWidget(self, widget)

setCurrentIndex(self, index)

setCursor(self, a0)

setDefaultDropAction(self, dropAction)

setDirtyRegion(self, region)

setDisabled(self, a0)

setDragDropMode(self, behavior)

setDragDropOverwriteMode(self, overwrite)

setDragEnabled(self, enable)

setDropIndicatorShown(self, enable)

setEditTriggers(self, triggers)

setEnabled(self, a0)

setExpanded(self, index, expand)

setExpandsOnDoubleClick(self, enable)

setFirstColumnSpanned(self, row, parent, span)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrameRect(self, a0)

setFrameShadow(self, a0)

setFrameShape(self, a0)

setFrameStyle(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHeader(self, header)

setHeaderHidden(self, hide)

setHidden(self, hidden)

setHorizontalScrollBar(self, scrollbar)

setHorizontalScrollBarPolicy(self, a0)

setHorizontalScrollMode(self, mode)

setIconSize(self, size)

setIndentation(self, i)

setIndexWidget(self, index, widget)

setInputMethodHints(self, hints)

setItemDelegate(self, delegate)

setItemDelegateForColumn(self, column, delegate)

setItemDelegateForRow(self, row, delegate)

setItemsExpandable(self, enable)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLineWidth(self, a0)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMidLineWidth(self, a0)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModel(self, model)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setRootIndex(self, index)

setRootIsDecorated(self, show)

setRowHidden(self, row, parent, hide)

setScreen(self, a0)

setSelection(self, rect, command)

setSelectionBehavior(self, behavior)

setSelectionMode(self, mode)

setSelectionModel(self, selectionModel)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeAdjustPolicy(self, policy)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setSortingEnabled(self, enable)

setState(self, state)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabKeyNavigation(self, enable)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTextElideMode(self, mode)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setTreePosition(self, logicalIndex)

setUniformRowHeights(self, uniform)

setUpdatesEnabled(self, enable)

setVerticalScrollBar(self, scrollbar)

setVerticalScrollBarPolicy(self, a0)

setVerticalScrollMode(self, mode)

setViewport(self, widget)

setViewportMargins(setViewportMargins)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

setWordWrap(self, on)

setupViewport(self, viewport)

sharedPainter(self)

show(self)

showColumn(self, column)

showDropIndicator(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeAdjustPolicy(self)

sizeHint(self)

sizeHintForColumn(self, column)

sizeHintForIndex(self, index)

sizeHintForRow(self, row)

sizeIncrement(self)

sizePolicy(self)

sortByColumn(self, column, order)

sort_branch(branch, order_list)

Sorts a branch in the treeView given an ordered list.

stackUnder(self, a0)

startDrag(self, supportedActions)

startTimer(self, interval[, timerType])

state(self)

statusTip(self)

style(self)

styleSheet(self)

tabKeyNavigation(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

textElideMode(self)

thread(self)

timerEvent(self, event)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

treePosition(self)

underMouse(self)

ungrabGesture(self, type)

uniformRowHeights(self)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update)

updateEditorData(self)

updateEditorGeometries(self)

updateGeometries(self)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

verticalOffset(self)

verticalScrollBar(self)

verticalScrollBarPolicy(self)

verticalScrollMode(self)

verticalScrollbarAction(self, action)

verticalScrollbarValueChanged(self, value)

viewport(self)

viewportEvent(self, event)

viewportMargins(self)

viewportSizeHint(self)

visibleRegion(self)

visualRect(self, index)

visualRegionForSelection(self, selection)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

wordWrap(self)

x(self)

y(self)

CursorAction

DragDropMode

DropIndicatorPosition

EditTrigger

PaintDeviceMetric

RenderFlag

ScrollHint

ScrollMode

SelectionBehavior

SelectionMode

Shadow

Shape

SizeAdjustPolicy

State

StyleMask

activated

clicked

collapsed

customContextMenuRequested

destroyed

doubleClicked

entered

expanded

iconSizeChanged

objectNameChanged

pressed

viewportEntered

windowIconChanged

windowIconTextChanged

windowTitleChanged

add_branch(parent_item, branch_name, data=None)[source]#

Add a new branch to the tree under the specified parent.

Parameters:
  • parent_item (QStandardItem) – The parent item to add the branch to.

  • branch_name (str) – The name of the new branch.

  • data (any, optional) – Optional data to associate with the branch.

Returns:

The created branch item.

Return type:

QStandardItem

add_leaf(branch_item, leaf_name, data=None)[source]#

Add a new leaf to a branch.

Parameters:
  • branch_item (QStandardItem) – The branch item to which the leaf will be added.

  • leaf_name (str) – The name of the new leaf.

  • data (any, optional) – Optional data to associate with the leaf.

Returns:

The created leaf item.

Return type:

QStandardItem

branch_exists(parent_item, branch_name)[source]#

Check if a branch with a given name exists under the specified parent item.

Parameters:
  • parent_item (QStandardItem) – The item to search under.

  • branch_name (str) – The name of the branch to look for.

Returns:

The branch item if found, otherwise None.

Return type:

QStandardItem or None

clear_tree()[source]#

Clears all items from the tree model.

find_leaf(branch_item, leaf_name)[source]#

Find a leaf under a branch by its name.

Parameters:
  • branch_item (QStandardItem) – The branch item to search within.

  • leaf_name (str) – The name of the leaf to find.

Returns:

The leaf item if found, otherwise None.

Return type:

QStandardItem or None

get_item_path(item)[source]#

Return the full path of an item as a list from root to the given item.

Parameters:

item (QStandardItem) – The item whose path is to be retrieved.

Returns:

A list representing the hierarchy from root to the item.

Return type:

list of str

get_leaf_data(leaf_item)[source]#

Return the full path of an item as a list from root to the given item.

Parameters:

item (QStandardItem) – The item whose path is to be retrieved.

Returns:

A list representing the hierarchy from root to the item.

Return type:

list of str

on_double_click(index)[source]#

Handle a double-click event on an item in the tree.

Parameters:

index (QModelIndex) – Index of the clicked item.

sort_branch(branch, order_list)[source]#

Sorts a branch in the treeView given an ordered list.

Parameters:
  • branch (QStandardItem) – Branch to sort leaf items.

  • order_list (list) – The desired order for the leaf items.

class common.CustomWidgets.DoubleSlider(min_value=0, max_value=100, step=1, initial_left=25, initial_right=75, parent=None)[source]#

Bases: QWidget

A dual-slider widget with editable input fields for setting a value range.

This widget features two horizontal QSliders for setting a minimum and maximum value, along with associated QLineEdits to allow manual text input. It emits combined signals when either slider changes, is moved, or released.

Parameters:
  • min_value (int, optional) – Minimum allowed slider value (default is 0).

  • max_value (int, optional) – Maximum allowed slider value (default is 100).

  • step (int, optional) – Step size between values (default is 1).

  • initial_left (int, optional) – Initial value for the left (lower) slider (default is 25).

  • initial_right (int, optional) – Initial value for the right (upper) slider (default is 75).

  • parent (QWidget, optional) – Parent widget (default is None).

Signals:
  • valueChanged(int, int) – Emitted when either slider value changes.

  • sliderMoved(int, int) – Emitted while either slider is being dragged.

  • sliderReleased(int, int) – Emitted when either slider handle is released.

  • sliderPressed(int, int) – Emitted when either slider handle is pressed.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLeftValue(value)

Sets the value of the left slider.

setLocale(self, locale)

setMask(setMask)

setMaximum(value)

Sets the maximum value for both sliders.

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimum(value)

Sets the minimum value for both sliders.

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setRightValue(value)

Sets the value of the right slider.

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStep(value)

Sets the step size for both sliders.

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setValues(values)

Sets values for both sliders.

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_sliders()

Updates slider values based on text input in the line edits.

update_values()

Updates the line edits to reflect the slider values and emits the valueChanged signal.

updatesEnabled(self)

values()

Returns the current values of both sliders.

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

sliderMoved

sliderPressed

sliderReleased

valueChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

setLeftValue(value)[source]#

Sets the value of the left slider.

Parameters:

value (int) – Desired value for the left slider.

setMaximum(value)[source]#

Sets the maximum value for both sliders.

Parameters:

value (int) – Maximum value.

setMinimum(value)[source]#

Sets the minimum value for both sliders.

Parameters:

value (int) – Minimum value.

setRightValue(value)[source]#

Sets the value of the right slider.

Parameters:

value (int) – Desired value for the right slider.

setStep(value)[source]#

Sets the step size for both sliders.

Parameters:

value (int) – Step size.

setValues(values)[source]#

Sets values for both sliders.

Parameters:

values (tuple of int) – Tuple containing (left_value, right_value).

sliderMoved#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sliderPressed#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

sliderReleased#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

update_sliders()[source]#

Updates slider values based on text input in the line edits. Invalid input is ignored.

update_values()[source]#

Updates the line edits to reflect the slider values and emits the valueChanged signal.

valueChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

values()[source]#

Returns the current values of both sliders.

Returns:

(left_value, right_value)

Return type:

tuple of int

class common.CustomWidgets.RotatedHeaderView(parent=None)[source]#

Bases: QHeaderView

A custom QHeaderView that displays horizontal headers rotated by 90 degrees.

This header view is useful for tables with many columns where horizontal space is constrained. It transposes the size hint and rotates the header text during painting to display the headers vertically.

Parameters:

parent (QWidget, optional) – The parent widget (typically a QTableView).

orientation#

The orientation of the header view. Fixed to Qt.Horizontal.

Type:

Qt.Orientation

minimumSectionSize#

The minimum size of each header section, set to 20 pixels.

Type:

int

paintSection(painter, rect, logicalIndex)[source]#

Paints a rotated header section by -90 degrees.

minimumSizeHint()[source]#

Returns the transposed minimum size hint for the rotated layout.

sectionSizeFromContents(logicalIndex)[source]#

Returns the transposed section size to accommodate vertical text.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addScrollBarWidget(self, widget, alignment)

adjustSize(self)

alternatingRowColors(self)

autoFillBackground(self)

autoScrollMargin(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

cascadingSectionResizes(self)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

clearSelection(self)

close(self)

closeEditor(self, editor, hint)

closeEvent(self, a0)

closePersistentEditor(self, index)

colorCount(self)

commitData(self, editor)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

cornerWidget(self)

count(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

currentChanged(self, current, old)

currentIndex(self)

cursor(self)

customEvent(self, a0)

dataChanged(self, topLeft, bottomRight[, roles])

defaultAlignment(self)

defaultDropAction(self)

defaultSectionSize(self)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

dirtyRegionOffset(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragDropMode(self)

dragDropOverwriteMode(self)

dragEnabled(self)

dragEnterEvent(self, e)

dragLeaveEvent(self, e)

dragMoveEvent(self, e)

drawFrame(self, a0)

dropEvent(self, e)

dropIndicatorPosition(self)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

edit()

editTriggers(self)

editorDestroyed(self, editor)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, e)

eventFilter(self, object, event)

executeDelayedItemsLayout(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, e)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, e)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameRect(self)

frameShadow(self)

frameShape(self)

frameSize(self)

frameStyle(self)

frameWidth(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasAutoScroll(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

headerDataChanged(self, orientation, ...)

height(self)

heightForWidth(self, a0)

heightMM(self)

hiddenSectionCount(self)

hide(self)

hideEvent(self, a0)

hideSection(self, alogicalIndex)

highlightSections(self)

horizontalOffset(self)

horizontalScrollBar(self)

horizontalScrollBarPolicy(self)

horizontalScrollMode(self)

horizontalScrollbarAction(self, action)

horizontalScrollbarValueChanged(self, value)

iconSize(self)

indexAt(self, p)

indexWidget(self, index)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

initStyleOptionForIndex(self, option, ...)

initViewItemOption(self, option)

initialize(self)

initializeSections(initializeSections)

inputMethodEvent(self, event)

inputMethodHints(self)

inputMethodQuery(self, query)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFirstSectionMovable(self)

isFullScreen(self)

isHidden(self)

isIndexHidden(self, index)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isPersistentEditorOpen(self, index)

isQuickItemType(self)

isRightToLeft(self)

isSectionHidden(self, logicalIndex)

isSignalConnected(self, signal)

isSortIndicatorClearable(self)

isSortIndicatorShown(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

itemDelegate(self)

itemDelegateForColumn(self, column)

itemDelegateForIndex(self, index)

itemDelegateForRow(self, row)

keyPressEvent(self, e)

keyReleaseEvent(self, a0)

keyboardGrabber()

keyboardSearch(self, search)

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

length(self)

lineWidth(self)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

logicalIndex(self, visualIndex)

logicalIndexAt(-> int  -> int)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSectionSize(self)

maximumSize(self)

maximumViewportSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

midLineWidth(self)

minimumHeight(self)

minimumSectionSize(self)

minimumSize(self)

minimumSizeHint()

Return the minimum size hint for the header.

minimumWidth(self)

model(self)

mouseDoubleClickEvent(self, e)

mouseGrabber()

mouseMoveEvent(self, e)

mousePressEvent(self, e)

mouseReleaseEvent(self, e)

move(move)

moveCursor(self, a0, a1)

moveEvent(self, a0)

moveSection(self, from_, to)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

offset(self)

openPersistentEditor(self, index)

orientation(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, e)

paintSection(painter, rect, logicalIndex)

Paint a single section of the header, rotating the text by -90 degrees.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

reset(self)

resetDefaultSectionSize(self)

resetHorizontalScrollMode(self)

resetVerticalScrollMode(self)

resize(resize)

resizeContentsPrecision(self)

resizeEvent(self, e)

resizeSection(self, logicalIndex, size)

resizeSections(resizeSections)

restoreGeometry(self, geometry)

restoreState(self, state)

rootIndex(self)

rowsAboutToBeRemoved(self, parent, start, end)

rowsInserted(self, parent, start, end)

saveGeometry(self)

saveState(self)

scheduleDelayedItemsLayout(self)

screen(self)

scroll(scroll)

scrollBarWidgets(self, alignment)

scrollContentsBy(self, dx, dy)

scrollDirtyRegion(self, dx, dy)

scrollTo(self, index, hint)

scrollToBottom(self)

scrollToTop(self)

sectionPosition(self, logicalIndex)

sectionResizeMode(self, logicalIndex)

sectionSize(self, logicalIndex)

sectionSizeFromContents(logicalIndex)

Return the size of a section, adjusted for rotated text.

sectionSizeHint(self, logicalIndex)

sectionViewportPosition(self, logicalIndex)

sectionsAboutToBeRemoved(self, parent, ...)

sectionsClickable(self)

sectionsHidden(self)

sectionsInserted(self, parent, logicalFirst, ...)

sectionsMovable(self)

sectionsMoved(self)

selectAll(self)

selectedIndexes(self)

selectionBehavior(self)

selectionChanged(self, selected, deselected)

selectionCommand(self, index[, event])

selectionMode(self)

selectionModel(self)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAlternatingRowColors(self, enable)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setAutoScroll(self, enable)

setAutoScrollMargin(self, margin)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCascadingSectionResizes(self, enable)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCornerWidget(self, widget)

setCurrentIndex(self, index)

setCursor(self, a0)

setDefaultAlignment(self, alignment)

setDefaultDropAction(self, dropAction)

setDefaultSectionSize(self, size)

setDirtyRegion(self, region)

setDisabled(self, a0)

setDragDropMode(self, behavior)

setDragDropOverwriteMode(self, overwrite)

setDragEnabled(self, enable)

setDropIndicatorShown(self, enable)

setEditTriggers(self, triggers)

setEnabled(self, a0)

setFirstSectionMovable(self, movable)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setFrameRect(self, a0)

setFrameShadow(self, a0)

setFrameShape(self, a0)

setFrameStyle(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setHighlightSections(self, highlight)

setHorizontalScrollBar(self, scrollbar)

setHorizontalScrollBarPolicy(self, a0)

setHorizontalScrollMode(self, mode)

setIconSize(self, size)

setIndexWidget(self, index, widget)

setInputMethodHints(self, hints)

setItemDelegate(self, delegate)

setItemDelegateForColumn(self, column, delegate)

setItemDelegateForRow(self, row, delegate)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLineWidth(self, a0)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSectionSize(self, size)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMidLineWidth(self, a0)

setMinimumHeight(self, minh)

setMinimumSectionSize(self, size)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModel(self, model)

setMouseTracking(self, enable)

setObjectName(self, name)

setOffset(self, offset)

setOffsetToLastSection(self)

setOffsetToSectionPosition(self, visualIndex)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setResizeContentsPrecision(self, precision)

setRootIndex(self, index)

setScreen(self, a0)

setSectionHidden(self, logicalIndex, hide)

setSectionResizeMode(setSectionResizeMode)

setSectionsClickable(self, clickable)

setSectionsMovable(self, movable)

setSelection(self, rect, flags)

setSelectionBehavior(self, behavior)

setSelectionMode(self, mode)

setSelectionModel(self, selectionModel)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeAdjustPolicy(self, policy)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setSortIndicator(self, logicalIndex, order)

setSortIndicatorClearable(self, clearable)

setSortIndicatorShown(self, show)

setState(self, state)

setStatusTip(self, a0)

setStretchLastSection(self, stretch)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabKeyNavigation(self, enable)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTextElideMode(self, mode)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVerticalScrollBar(self, scrollbar)

setVerticalScrollBarPolicy(self, a0)

setVerticalScrollMode(self, mode)

setViewport(self, widget)

setViewportMargins(setViewportMargins)

setVisible(self, v)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

setupViewport(self, viewport)

sharedPainter(self)

show(self)

showDropIndicator(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

showSection(self, alogicalIndex)

signalsBlocked(self)

size(self)

sizeAdjustPolicy(self)

sizeHint(self)

sizeHintForColumn(self, column)

sizeHintForIndex(self, index)

sizeHintForRow(self, row)

sizeIncrement(self)

sizePolicy(self)

sortIndicatorOrder(self)

sortIndicatorSection(self)

stackUnder(self, a0)

startDrag(self, supportedActions)

startTimer(self, interval[, timerType])

state(self)

statusTip(self)

stretchLastSection(self)

stretchSectionCount(self)

style(self)

styleSheet(self)

swapSections(self, first, second)

tabKeyNavigation(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

textElideMode(self)

thread(self)

timerEvent(self, e)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update)

updateEditorData(self)

updateEditorGeometries(self)

updateGeometries(self)

updateGeometry(self)

updateMicroFocus(self[, query])

updateSection(self, logicalIndex)

updatesEnabled(self)

verticalOffset(self)

verticalScrollBar(self)

verticalScrollBarPolicy(self)

verticalScrollMode(self)

verticalScrollbarAction(self, action)

verticalScrollbarValueChanged(self, value)

viewport(self)

viewportEvent(self, e)

viewportMargins(self)

viewportSizeHint(self)

visibleRegion(self)

visualIndex(self, logicalIndex)

visualIndexAt(self, position)

visualRect(self, index)

visualRegionForSelection(self, selection)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

CursorAction

DragDropMode

DropIndicatorPosition

EditTrigger

PaintDeviceMetric

RenderFlag

ResizeMode

ScrollHint

ScrollMode

SelectionBehavior

SelectionMode

Shadow

Shape

SizeAdjustPolicy

State

StyleMask

activated

clicked

customContextMenuRequested

destroyed

doubleClicked

entered

geometriesChanged

iconSizeChanged

objectNameChanged

pressed

sectionClicked

sectionCountChanged

sectionDoubleClicked

sectionEntered

sectionHandleDoubleClicked

sectionMoved

sectionPressed

sectionResized

sortIndicatorChanged

sortIndicatorClearableChanged

viewportEntered

windowIconChanged

windowIconTextChanged

windowTitleChanged

minimumSizeHint()[source]#

Return the minimum size hint for the header.

Returns:

The minimum size hint, transposed due to rotation.

Return type:

QSize

paintSection(painter, rect, logicalIndex)[source]#

Paint a single section of the header, rotating the text by -90 degrees.

Parameters:
  • painter (QPainter) – The painter used to draw the section.

  • rect (QRect) – The bounding rectangle of the section.

  • logicalIndex (int) – The index of the section being painted.

sectionSizeFromContents(logicalIndex)[source]#

Return the size of a section, adjusted for rotated text.

Parameters:

logicalIndex (int) – The index of the section.

Returns:

The size of the section, transposed for vertical layout.

Return type:

QSize

class common.CustomWidgets.StandardItem(txt='', font_size=10, set_bold=False, data=None)[source]#

Bases: QStandardItem

Extends properties of QStandardItem for QTreeView and QList items.

Parameters:
  • txt (str, optional) – Text displayed in tree or list, by default ''

  • font_size (int, optional) – fontsize, by default 10

  • set_bold (bool, optional) – Bold tree font when True, by default False

Methods

accessibleDescription(self)

accessibleText(self)

appendColumn(self, items)

appendRow(appendRow)

appendRows(self, items)

background(self)

checkState(self)

child(self, row[, column])

clearData(self)

clone(self)

column(self)

columnCount(self)

data(self[, role])

emitDataChanged(self)

flags(self)

font(self)

foreground(self)

hasChildren(self)

icon(self)

index(self)

insertColumn(self, column, items)

insertColumns(self, column, count)

insertRow(insertRow)

insertRows(insertRows)

isAutoTristate(self)

isCheckable(self)

isDragEnabled(self)

isDropEnabled(self)

isEditable(self)

isEnabled(self)

isSelectable(self)

isUserTristate(self)

model(self)

parent(self)

read(self, in_)

removeColumn(self, column)

removeColumns(self, column, count)

removeRow(self, row)

removeRows(self, row, count)

row(self)

rowCount(self)

setAccessibleDescription(self, ...)

setAccessibleText(self, aaccessibleText)

setAutoTristate(self, tristate)

setBackground(self, abrush)

setCheckState(self, acheckState)

setCheckable(self, checkable)

setChild(setChild)

setColumnCount(self, columns)

setData(self, value[, role])

setDragEnabled(self, dragEnabled)

setDropEnabled(self, dropEnabled)

setEditable(self, editable)

setEnabled(self, enabled)

setFlags(self, flags)

setFont(self, afont)

setForeground(self, abrush)

setIcon(self, aicon)

setRowCount(self, rows)

setSelectable(self, selectable)

setSizeHint(self, asizeHint)

setStatusTip(self, astatusTip)

setText(self, atext)

setTextAlignment(self, atextAlignment)

setToolTip(self, atoolTip)

setUserTristate(self, tristate)

setWhatsThis(self, awhatsThis)

sizeHint(self)

sortChildren(self, column[, order])

statusTip(self)

takeChild(self, row[, column])

takeColumn(self, column)

takeRow(self, row)

text(self)

textAlignment(self)

toolTip(self)

type(self)

whatsThis(self)

write(self, out)

ItemType

class common.CustomWidgets.ToggleSwitch(parent=None, height=24, duration=100, fg_color='#f0f0f0', bg_left_color='#ffffff', bg_right_color='#478ae4')[source]#

Bases: QWidget

A custom toggle switch widget with animated transitions and customizable colors.

This widget mimics a modern on/off switch, commonly used in mobile and web UIs. It supports smooth animated transitions between the “on” and “off” states, emits a signal when toggled, and provides optional customization for height, animation duration, and colors.

Parameters:
  • parent (QWidget, optional) – The parent widget, by default None.

  • height (int, optional) – Height of the toggle switch. The width is automatically set to twice the height. Default is 24.

  • duration (int, optional) – Duration of the toggle animation in milliseconds. Default is 100.

  • fg_color (str, optional) – Foreground color (thumb/slider) in hex format. Default is “#f0f0f0”.

  • bg_left_color (str, optional) – Background color when the switch is in the “off” position. Default is “#ffffff”.

  • bg_right_color (str, optional) – Background color when the switch is in the “on” position. Default is “#478ae4”.

Signals:

stateChanged (bool) – Emitted when the switch state changes.

thumb_pos#

Position of the thumb (used for animation).

Type:

float

toggle()[source]#

Toggles the switch state and emits the stateChanged signal.

setChecked(checked)[source]#

Sets the checked state and animates the thumb.

isChecked() bool[source]#

Returns the current checked state.

Attributes:
thumb_pos

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_thumb_pos()

Returns the thumb position.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isChecked()

Return the current state of the toggle switch.

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(event)

Handles mouse press events to toggle the switch state when clicked.

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(event)

Draw the toggle switch.

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setChecked(checked)

Sets the checked state of the toggle switch and triggers the animation

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

set_thumb_pos(pos)

Sets the thumb position.

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint()

Returns the size of the toggle switch.

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toggle()

Toggle switch state and emit signal

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

stateChanged

thumb_pos

windowIconChanged

windowIconTextChanged

windowTitleChanged

get_thumb_pos()[source]#

Returns the thumb position.

isChecked() bool[source]#

Return the current state of the toggle switch.

Returns:

Returns checked state of the toggle switch

Return type:

bool

mousePressEvent(event)[source]#

Handles mouse press events to toggle the switch state when clicked.

If the left mouse button is pressed, this method toggles the checked state of the switch.

Parameters:

event (QMouseEvent) – The mouse event triggered by the user interaction.

paintEvent(event)[source]#

Draw the toggle switch.

Draws the toggle switch.

Parameters:

event (QEvent)

setChecked(checked: bool)[source]#

Sets the checked state of the toggle switch and triggers the animation

Parameters:

checked (bool) – New check state of the toggle switch.

set_thumb_pos(pos)[source]#

Sets the thumb position.

sizeHint()[source]#

Returns the size of the toggle switch.

Returns:

size – Returns the size of the toggle switch.

Return type:

QSize

stateChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

thumb_pos#
pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

toggle()[source]#

Toggle switch state and emit signal

class common.CustomWidgets.VisibilityWidget[source]#

Bases: QWidget

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

hideEvent(self, a0: QHideEvent | None)[source]#
showEvent(self, a0: QShowEvent | None)[source]#
visibilityChanged#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

common.DataHandling module#

class common.DataHandling.LaserSampleObj(sample_id, file_path, outlier_method, negative_method, smoothing_method=None, ref_chem=None, ui=None)[source]#

Bases: SampleObj

Attributes:
apply_outlier_to_all

bool : flag that indicates whether the outlier method should be applied to all analytes.

array_size

tuple : (int, int) Size of map in pixels

aspect_ratio

float : Aspect ratio of maps (dy / dx).

auto_scale_value
crop_mask

numpy.ndarray: Boolean mask used to crop the raw data. True values will be used.

current_field

str :

data_max_diff_quantile

float : maximum quantile for differences used for autoscaling.

data_max_quantile

float : maximum quantile used for autoscaling.

data_min_diff_quantile

float : minimum quantile for differences used for autoscaling.

data_min_quantile

float : minimum quantile used for autoscaling.

dx

float : Width of pixels in x-direction.

dy

float : Width of pixels in y-direction.

negative_method

str : Method for negative handling.

nx
ny
outlier_method

str : Method for predicting and clipping outliers.

ref_chem

dict : Reference chemistry

valid_data_types

list : data types possible for in processed data.

x

numpy.ndarray : Value of x-coordinate associated with map data

x_range

float : Range of pixels in x-direction.

xlim

list : (float, float) Limits of pixels in x-direction.

y

numpy.ndarray : Value of y-coordinate associated with map data

y_range

float : Range of pixels in y-direction.

ylim

list : (float, float) Limits of pixels in y-direction.

Methods

add_columns(data_type, column_names, array)

Add one or more columns to the sample object.

add_observer(event_name, callback)

Register a callback function to be called when a property changes.

apply_field_filters()

Applies filters based on field values.

auto_scale(sample_id, field[, update])

Auto-scales pixel values in map

clip_outliers(array, outlier_method[, pl, ...])

Attempts to remove outliers to by a method selected by the user.

cluster_data()

Clusters data for use with data preprocessing

compute_ratio(analyte_1, analyte_2)

Compute a ratio field from two analytes.

confirm_reset()

A simple dialog that ensures the user wishes to reset data

create_label(column_name)

Creates a default label for axes.

delete_column(column_name)

Deletes a column and associated attributes from the AttributeDataFrame.

get_map_data(field[, field_type, norm, ...])

Retrieves and processes the mapping data for the given sample and analytes

get_processed_data()

Gets the processed data for analysis

get_vector(field_type, field[, norm, processed])

Creates a dictionary of values for plotting

k_optimal_clusters(data[, max_clusters])

Predicts the optimal number of clusters.

notify_observers(event_name, *args, **kwargs)

Notify all registered observers of an event or property change.

prep_data([field])

Applies adjustments to data data prior to analyses and plotting.

remove_observer(event_name, callback)

Deregister a callback function from an event.

reset_crop()

Reset the data to the original bounds.

reset_data()

Reverts back to the original data.

reset_data_handling()

Resets processed data back to raw before performing autoscaling.

reset_resolution()

Resets dx and dy to initial values.

scale_options([plot_type, ax, field_type, field])

list : options for scaling the data.

sort_data(method)

Sorts analyte columns in the raw and processed data according to the specified method.

swap_resolution()

Swaps DX and DY for a dataframe, updates X and Y

swap_xy()

Swaps data in a SampleObj.

transform_array(array, negative_method)

Negative and zero handling with clustering for noise detection.

update_norm([norm, field])

Update the norm of the data.

update_resolution(axis, value)

Updates DX and DY for a dataframe

add_columns(data_type, column_names, array, mask=None)#

Add one or more columns to the sample object.

Adds one or more columns to SampleObj.processed. If a mask is provided, the data is placed in the correct rows based on the mask.

Parameters:
  • data_type (str) – The type of data stored in the columns.

  • column_names (str or list of str) – The name or names of the columns to add. If a column already exists, it will be overwritten.

  • array (numpy.ndarray) – A 1D array (for single column) or 2D array (for multiple columns). The data to be added.

  • mask (numpy.ndarray, optional) – A boolean mask that indicates which rows in the original data should be filled. If not provided, the length of array must match the height of processed data.

Returns:

Returns a message if a column is overwritten, or a dictionary with column names as keys and “overwritten” or “added” as values if multiple columns are added.

Return type:

dict or str

Raises:
  • ValueError – Valid types are given in SampleObj._valid_data_types.

  • ValueError – The number of columns in the array must match the length of column_names (if multiple columns are being added).

  • ValueError – The length of array must match the height of processed data if no mask is provided.

  • ValueError – If a mask is provided, its length must match the height of processed data, and the number of True values in the mask must match the number of rows in array.

add_observer(event_name: str, callback: Callable)#

Register a callback function to be called when a property changes.

apply_field_filters()#

Applies filters based on field values.

Field-based filters are stored in self.filter_df. This method updates self.filter_mask.

auto_scale(sample_id, field, update=False)#

Auto-scales pixel values in map

Executes on MainWindow.toolButtonAutoScale click.

Outliers can make it difficult to view the variations of values within a map. This is a larger problem for linear scales, but can happen when log-scaled. Auto- scaling the data clips the values at a lower and upper bound. Auto-scaling may be acceptable as minerals that were not specifically calibrated can have erroneously high or low (even negative) values.

Parameters:

update (bool) – Update auto scale parameters, by default, False

clip_outliers(array, outlier_method, pl=None, pu=None, dpl=None, dpu=None)#

Attempts to remove outliers to by a method selected by the user.

Parameters:
  • array (numpy.ndarray) – Data vector

  • outlier_method (str) – Method for removing outliers

  • pl (float, optional) – Lower percentile bound required by selected methods

  • pu (float, optional) – Upper percentile bound required by selected methods

  • dpl (float, optional) – Lower percentile bound for distances required by selected methods

  • dpu (float, optional) – Upper percentile bound for distances required by selected methods

Returns:

Clipped data vector

Return type:

numpy.ndarray

cluster_data()#

Clusters data for use with data preprocessing

_extended_summary_

compute_ratio(analyte_1, analyte_2)#

Compute a ratio field from two analytes.

Ratios are computed on the processed data, after negative handling, but before autoscaling.

Parameters:
  • analyte_1 (str) – Analyte field to be used as numerator of ratio.

  • analyte_2 (str) – Analyte field to be used as denominator of ratio.

confirm_reset()#

A simple dialog that ensures the user wishes to reset data

Returns:

True indicates user clicked Yes, False for No

Return type:

bool

create_label(column_name)#

Creates a default label for axes.

Creates a default label for axes on plots, using the column name in processed data.

Parameters:

column_name (str) – Column in processed data.

delete_column(column_name)#

Deletes a column and associated attributes from the AttributeDataFrame.

Parameters:

column_name (str) – Name of column to remove.

Raises:

ValueError – Raises an error if the column is not a member of the AttributeDataFrame.

get_map_data(field, field_type='Analyte', norm=False, processed=True)#

Retrieves and processes the mapping data for the given sample and analytes

The method also updates certain parameters in the analyte data frame related to scaling. Based on the plot type, this method internally calls the appropriate plotting functions.

Parameters:
  • field (str) – Name of field to plot. By default None.

  • field_type (str, optional) – Type of field to plot. Types include ‘Analyte’, ‘Ratio’, ‘PCA’, ‘Cluster’, ‘Cluster score’, ‘Special’, ‘Computed’. By default ‘Analyte’

  • norm (str) – Scale data as linear, log, etc. based on stored norm. If scale_data is False, the data are returned with a linear scale. By default False.

Returns:

Processed data for plotting. This is only returned if analysis_type is not ‘laser’ or ‘hist’.

Return type:

pandas.DataFrame

get_processed_data()#

Gets the processed data for analysis

Returns:

  • pandas.DataFrame – Filtered data frame

  • bool – Analytes included from processed data

get_vector(field_type, field, norm='linear', processed=True)#

Creates a dictionary of values for plotting

Returns:

Dictionary with array and additional relevant plot data, contains ‘field’, ‘type’, ‘label’, and ‘array’.

Return type:

dict

k_optimal_clusters(data, max_clusters=10)#

Predicts the optimal number of clusters.

Predicts the optimal number of k-means clusters using the elbow method based on the within-cluster sum of squares (WCSS):

\[WCSS = \sum_{i=1}^k \sum_{x \in C_i} (x - \mu_i)^2\]

The optimal number of clusters is determined by selecting the k-value corresponding to the maximum value of the second derivative of WCSS.

Parameters:
  • data (numpy.ndarray) – Data used in clustering. Make sure it has NaN and ±inf values removed.

  • max_clusters (int, optional) – Computes cluster results from 1 to max_clusters, by default 10.

Returns:

The optimal number of k-means clusters.

Return type:

int

notify_observers(event_name: str, *args, **kwargs)#

Notify all registered observers of an event or property change.

prep_data(field=None)#

Applies adjustments to data data prior to analyses and plotting.

This method applies a workflow to adjust data to limit the number of data that are otherwise unusable due to incorrect calibrations, particularly for low and high element concentration regions.

Data are adjusted according to the proceedure: | Determine optimal number of clusters and use it to classify the data using kmeans. | Transform each cluster, by handling negative data. The method of negative handling is set by MainWindow.comboBoxNegativeMethod.currentText(). | Compute ratios not imported (i.e., not in raw_data). | Determine outliers and limit their impact on analyses by clipping/autoscaling

These calculations start from the cropped data, but do not include chemical, polygonal, or cluster filtering.

Raises:

AssertionError – processed data has not yet been initialized. processed data should be created when the sample is initialized and prep_data is run for the first time.

property ref_chem#

Reference chemistry

Type:

dict

remove_observer(event_name: str, callback: Callable)#

Deregister a callback function from an event.

reset_crop()#

Reset the data to the original bounds.

Reseting the data to the original bounds results in deleting progress on analyses, computations, etc.

reset_data()#

Reverts back to the original data.

What is reset?

What is not reset?

reset_data_handling()#

Resets processed data back to raw before performing autoscaling.

Any computed fields will be removed.

reset_resolution()#

Resets dx and dy to initial values.

scale_options(plot_type=None, ax=None, field_type: str = None, field: str = None)#

list : options for scaling the data.

sort_data(method)#

Sorts analyte columns in the raw and processed data according to the specified method.

This method retrieves a list of analytes from the processed data DataFrame and reorders the columns in both raw and processed data based on the sorting strategy provided. The sorting is performed using an external function sort_analytes, which takes the user-defined method and the analyte list as inputs.

Parameters:

method (str) – Sorting method selected by the user. This is passed to sort_analytes and determines the order in which analytes are arranged (e.g., alphabetical, PCA loadings, cluster association, etc.).

Returns:

  • analyte_list (list) – the original list of analytes found in processed data.

  • sorted_analyte_list (list) – the list of analytes sorted according to the provided method.

swap_resolution()#

Swaps DX and DY for a dataframe, updates X and Y

Recalculates X and Y for a dataframe

swap_xy()#

Swaps data in a SampleObj.

transform_array(array, negative_method)#

Negative and zero handling with clustering for noise detection.

Parameters:
  • array (numpy.ndarray) – Input data

  • negative_method (str) – Method for handling negative values

Returns:

Transformed data

Return type:

numpy.ndarray

update_norm(norm=None, field=None)#

Update the norm of the data.

Parameters:
  • sample_id (str) – Sample identifier

  • norm (str, optional) – Data scale method linear or log, by default None

  • field (str, optional) – Field to change the norm, by default None

  • update (bool, optional) – Update the scale information of the data, by default False

update_resolution(axis, value)#

Updates DX and DY for a dataframe

Recalculates X and Y for a dataframe when the user changes the value of pixel dimensions Dx or Dy

class common.DataHandling.SampleObj(sample_id, file_path, outlier_method, negative_method, smoothing_method=None, ui=None)[source]#

Bases: Observable

Creates a base sample object to store and manipulate geochemical data in map form

The sample object is initially constructed from the data within a *.lame.csv file and loaded into the raw_data dataframe. The sample object also contains a number of properties in addition to the input data. These include metadata that are linked to each column. To make this link, the dataframe is initialized as an ExtendedDF.AttributeDataFrame, which brings with it a number of methods to set, get and search the dataframe’s metadata.

Parameters:
  • sample_id (str) – Sample identifier.

  • file_path (str) – Path to data file for sample_id

  • outlier_method (str) – Method used ot handle outliers in the dataset

  • negative_method (str) – Method used to handle negative values in the dataset

  • ref_chem (pandas.DataFrame) – Reference chemistry for normalizing data

  • debug (bool, optional) – If true, will result in verbose output to stdout

reset_data :

Reverts back to the original data

add_columns :

Add one or more columns to the sample object

delete_column :

Deletes a column and associated attributes from the AttributeDataFrame

get_attribute_dict :

Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name

swap_xy :

Swaps data in a SampleObj

_swap_xy :

Swaps X and Y of a dataframe

swap_resolution :

Swaps DX and DY for a dataframe

reset_crop :

Reset the data to the new bounds.

compute_ratio :

Compute a ratio field from two analytes

cluster_data :

Clusters data for use with data preprocessing

prep_data :

Applies adjustments to data data prior to analyses and plotting

k_optimal_clusters :

Predicts the optimal number of clusters

outlier_detection :

Outlier detection with cluster-based correction for negatives and compositional constraints, using percentile-based shifting

transform_array :

Negative and zero handling with clustering for noise detection

update_norm :

Update the norm of the data

get_map_data :

Retrieves and processes the mapping data for the given sample and analytes

get_processed_data :

Gets the processed data for analysis

get_vector :

Creates a dictionary of values for plotting

ref_chemdict

Reference chemistry. By default None.

update_crop_mask#

Automatically update the crop_mask whenever crop bounds change.

reset_crop[source]#

Resets dataframe to original bounds.

raw#
filter_df#
‘field_type’ : (str) – field type
‘field’ : (str) – name of field
‘norm’ : (str) – scale normalization function, linear or log
‘min’ : (float) – minimum value for filtering
‘max’ : (float) – maximum value for filtering
‘operator’ : (str) – boolean operator for combining filters, and or or
‘use’ : (bool) – True indicates the filter should be used to filter data
‘persistent’ : (bool) – True retains the filter when the sample is changed
‘crop’ : () –
‘x_max’ : () –
‘x_min’ : () –
‘y_max’ : () –
‘y_min’ : () –
‘crop_x_max’ : () –
‘crop_x_min’ : () –
‘crop_y_max’ : () –
‘crop_y_min’ : () –
‘processed data’: () –
‘raw_data’: () –
‘cropped_raw_data’: () –
‘crop’ : () –
‘x_max’ : () –
‘x_min’ : () –
‘y_max’ : () –
‘y_min’ : () –
‘crop_x_max’ : () –
‘crop_x_min’ : () –
‘crop_y_max’ : () –
‘crop_y_min’ : () –
‘raw_data’: () –
‘cropped_raw_data’: () –
‘raw data’ : (pandas.DataFrame) –
‘x_min’ : (float) – minimum x of full data
‘x_max’ : (float) – maximum x of full data
‘y_min’ : (float) – minimum y of full data
‘y_max’ : (float) – maximum y of full data
‘crop_x_min’ : (float) – minimum x of cropped data
‘crop_x_max’ : (float) – maximum x of cropped data
‘crop_x_min’ : (float) – minimum y of cropped data
‘crop_x_max’ : (float) – maximum y of cropped data
‘norm’ : () –
‘analysis data’ : (pandas.DataFrame) –
‘cropped_raw_data’ : (pandas.DataFrame) –
Type:

(pandas.DataFrame) – stores filters for each sample

'processed'
Type:

(pandas.DataFrame) –

'crop_mask'
Type:

(MaskObj) – mask created from cropped axes.

'filter_mask'
Type:

(MaskObj) – mask created by a combination of filters. Filters are displayed for the user in tableWidgetFilters.

'polygon_mask'
Type:

(MaskObj) – mask created from selected polygons.

'cluster_mask'
Type:

(MaskObj) – mask created from selected or inverse selected cluster groups. Once this mask is set, it cannot be reset unless it is turned off, clustering is recomputed, and selected clusters are used to produce a new mask.

'mask'
Type:

() – combined mask, derived from filter_mask & ‘polygon_mask’ & ‘crop_mask’

Attributes:
apply_outlier_to_all

bool : flag that indicates whether the outlier method should be applied to all analytes.

array_size

tuple : (int, int) Size of map in pixels

aspect_ratio

float : Aspect ratio of maps (dy / dx).

auto_scale_value
crop_mask

numpy.ndarray: Boolean mask used to crop the raw data. True values will be used.

current_field

str :

data_max_diff_quantile

float : maximum quantile for differences used for autoscaling.

data_max_quantile

float : maximum quantile used for autoscaling.

data_min_diff_quantile

float : minimum quantile for differences used for autoscaling.

data_min_quantile

float : minimum quantile used for autoscaling.

dx

float : Width of pixels in x-direction.

dy

float : Width of pixels in y-direction.

negative_method

str : Method for negative handling.

nx
ny
outlier_method

str : Method for predicting and clipping outliers.

valid_data_types

list : data types possible for in processed data.

x

numpy.ndarray : Value of x-coordinate associated with map data

x_range

float : Range of pixels in x-direction.

xlim

list : (float, float) Limits of pixels in x-direction.

y

numpy.ndarray : Value of y-coordinate associated with map data

y_range

float : Range of pixels in y-direction.

ylim

list : (float, float) Limits of pixels in y-direction.

Methods

add_columns(data_type, column_names, array)

Add one or more columns to the sample object.

add_observer(event_name, callback)

Register a callback function to be called when a property changes.

apply_field_filters()

Applies filters based on field values.

auto_scale(sample_id, field[, update])

Auto-scales pixel values in map

clip_outliers(array, outlier_method[, pl, ...])

Attempts to remove outliers to by a method selected by the user.

cluster_data()

Clusters data for use with data preprocessing

compute_ratio(analyte_1, analyte_2)

Compute a ratio field from two analytes.

confirm_reset()

A simple dialog that ensures the user wishes to reset data

create_label(column_name)

Creates a default label for axes.

delete_column(column_name)

Deletes a column and associated attributes from the AttributeDataFrame.

get_map_data(field[, field_type, norm, ...])

Retrieves and processes the mapping data for the given sample and analytes

get_processed_data()

Gets the processed data for analysis

get_vector(field_type, field[, norm, processed])

Creates a dictionary of values for plotting

k_optimal_clusters(data[, max_clusters])

Predicts the optimal number of clusters.

notify_observers(event_name, *args, **kwargs)

Notify all registered observers of an event or property change.

prep_data([field])

Applies adjustments to data data prior to analyses and plotting.

remove_observer(event_name, callback)

Deregister a callback function from an event.

reset_crop()

Reset the data to the original bounds.

reset_data()

Reverts back to the original data.

reset_data_handling()

Resets processed data back to raw before performing autoscaling.

reset_resolution()

Resets dx and dy to initial values.

scale_options([plot_type, ax, field_type, field])

list : options for scaling the data.

sort_data(method)

Sorts analyte columns in the raw and processed data according to the specified method.

swap_resolution()

Swaps DX and DY for a dataframe, updates X and Y

swap_xy()

Swaps data in a SampleObj.

transform_array(array, negative_method)

Negative and zero handling with clustering for noise detection.

update_norm([norm, field])

Update the norm of the data.

update_resolution(axis, value)

Updates DX and DY for a dataframe

add_columns(data_type, column_names, array, mask=None)[source]#

Add one or more columns to the sample object.

Adds one or more columns to SampleObj.processed. If a mask is provided, the data is placed in the correct rows based on the mask.

Parameters:
  • data_type (str) – The type of data stored in the columns.

  • column_names (str or list of str) – The name or names of the columns to add. If a column already exists, it will be overwritten.

  • array (numpy.ndarray) – A 1D array (for single column) or 2D array (for multiple columns). The data to be added.

  • mask (numpy.ndarray, optional) – A boolean mask that indicates which rows in the original data should be filled. If not provided, the length of array must match the height of processed data.

Returns:

Returns a message if a column is overwritten, or a dictionary with column names as keys and “overwritten” or “added” as values if multiple columns are added.

Return type:

dict or str

Raises:
  • ValueError – Valid types are given in SampleObj._valid_data_types.

  • ValueError – The number of columns in the array must match the length of column_names (if multiple columns are being added).

  • ValueError – The length of array must match the height of processed data if no mask is provided.

  • ValueError – If a mask is provided, its length must match the height of processed data, and the number of True values in the mask must match the number of rows in array.

add_observer(event_name: str, callback: Callable)#

Register a callback function to be called when a property changes.

apply_field_filters()[source]#

Applies filters based on field values.

Field-based filters are stored in self.filter_df. This method updates self.filter_mask.

property apply_outlier_to_all#

flag that indicates whether the outlier method should be applied to all analytes.

Type:

bool

property array_size#

(int, int) Size of map in pixels

Type:

tuple

property aspect_ratio#

Aspect ratio of maps (dy / dx).

Type:

float

auto_scale(sample_id, field, update=False)[source]#

Auto-scales pixel values in map

Executes on MainWindow.toolButtonAutoScale click.

Outliers can make it difficult to view the variations of values within a map. This is a larger problem for linear scales, but can happen when log-scaled. Auto- scaling the data clips the values at a lower and upper bound. Auto-scaling may be acceptable as minerals that were not specifically calibrated can have erroneously high or low (even negative) values.

Parameters:

update (bool) – Update auto scale parameters, by default, False

property auto_scale_value#
clip_outliers(array, outlier_method, pl=None, pu=None, dpl=None, dpu=None)[source]#

Attempts to remove outliers to by a method selected by the user.

Parameters:
  • array (numpy.ndarray) – Data vector

  • outlier_method (str) – Method for removing outliers

  • pl (float, optional) – Lower percentile bound required by selected methods

  • pu (float, optional) – Upper percentile bound required by selected methods

  • dpl (float, optional) – Lower percentile bound for distances required by selected methods

  • dpu (float, optional) – Upper percentile bound for distances required by selected methods

Returns:

Clipped data vector

Return type:

numpy.ndarray

cluster_data()[source]#

Clusters data for use with data preprocessing

_extended_summary_

compute_ratio(analyte_1, analyte_2)[source]#

Compute a ratio field from two analytes.

Ratios are computed on the processed data, after negative handling, but before autoscaling.

Parameters:
  • analyte_1 (str) – Analyte field to be used as numerator of ratio.

  • analyte_2 (str) – Analyte field to be used as denominator of ratio.

confirm_reset()[source]#

A simple dialog that ensures the user wishes to reset data

Returns:

True indicates user clicked Yes, False for No

Return type:

bool

create_label(column_name)[source]#

Creates a default label for axes.

Creates a default label for axes on plots, using the column name in processed data.

Parameters:

column_name (str) – Column in processed data.

property crop_mask#

Boolean mask used to crop the raw data. True values will be used.

Type:

numpy.ndarray

property current_field#

str:

property data_max_diff_quantile#

maximum quantile for differences used for autoscaling.

Type:

float

property data_max_quantile#

maximum quantile used for autoscaling.

Type:

float

property data_min_diff_quantile#

minimum quantile for differences used for autoscaling.

Type:

float

property data_min_quantile#

minimum quantile used for autoscaling.

Type:

float

delete_column(column_name)[source]#

Deletes a column and associated attributes from the AttributeDataFrame.

Parameters:

column_name (str) – Name of column to remove.

Raises:

ValueError – Raises an error if the column is not a member of the AttributeDataFrame.

property dx#

Width of pixels in x-direction.

Type:

float

property dy#

Width of pixels in y-direction.

Type:

float

get_map_data(field, field_type='Analyte', norm=False, processed=True)[source]#

Retrieves and processes the mapping data for the given sample and analytes

The method also updates certain parameters in the analyte data frame related to scaling. Based on the plot type, this method internally calls the appropriate plotting functions.

Parameters:
  • field (str) – Name of field to plot. By default None.

  • field_type (str, optional) – Type of field to plot. Types include ‘Analyte’, ‘Ratio’, ‘PCA’, ‘Cluster’, ‘Cluster score’, ‘Special’, ‘Computed’. By default ‘Analyte’

  • norm (str) – Scale data as linear, log, etc. based on stored norm. If scale_data is False, the data are returned with a linear scale. By default False.

Returns:

Processed data for plotting. This is only returned if analysis_type is not ‘laser’ or ‘hist’.

Return type:

pandas.DataFrame

get_processed_data()[source]#

Gets the processed data for analysis

Returns:

  • pandas.DataFrame – Filtered data frame

  • bool – Analytes included from processed data

get_vector(field_type, field, norm='linear', processed=True)[source]#

Creates a dictionary of values for plotting

Returns:

Dictionary with array and additional relevant plot data, contains ‘field’, ‘type’, ‘label’, and ‘array’.

Return type:

dict

k_optimal_clusters(data, max_clusters=10)[source]#

Predicts the optimal number of clusters.

Predicts the optimal number of k-means clusters using the elbow method based on the within-cluster sum of squares (WCSS):

\[WCSS = \sum_{i=1}^k \sum_{x \in C_i} (x - \mu_i)^2\]

The optimal number of clusters is determined by selecting the k-value corresponding to the maximum value of the second derivative of WCSS.

Parameters:
  • data (numpy.ndarray) – Data used in clustering. Make sure it has NaN and ±inf values removed.

  • max_clusters (int, optional) – Computes cluster results from 1 to max_clusters, by default 10.

Returns:

The optimal number of k-means clusters.

Return type:

int

property negative_method#

Method for negative handling.

Type:

str

notify_observers(event_name: str, *args, **kwargs)#

Notify all registered observers of an event or property change.

property nx#
property ny#
property outlier_method#

Method for predicting and clipping outliers.

Type:

str

prep_data(field=None)[source]#

Applies adjustments to data data prior to analyses and plotting.

This method applies a workflow to adjust data to limit the number of data that are otherwise unusable due to incorrect calibrations, particularly for low and high element concentration regions.

Data are adjusted according to the proceedure: | Determine optimal number of clusters and use it to classify the data using kmeans. | Transform each cluster, by handling negative data. The method of negative handling is set by MainWindow.comboBoxNegativeMethod.currentText(). | Compute ratios not imported (i.e., not in raw_data). | Determine outliers and limit their impact on analyses by clipping/autoscaling

These calculations start from the cropped data, but do not include chemical, polygonal, or cluster filtering.

Raises:

AssertionError – processed data has not yet been initialized. processed data should be created when the sample is initialized and prep_data is run for the first time.

remove_observer(event_name: str, callback: Callable)#

Deregister a callback function from an event.

reset_crop()[source]#

Reset the data to the original bounds.

Reseting the data to the original bounds results in deleting progress on analyses, computations, etc.

reset_data()[source]#

Reverts back to the original data.

What is reset?

What is not reset?

reset_data_handling()[source]#

Resets processed data back to raw before performing autoscaling.

Any computed fields will be removed.

reset_resolution()[source]#

Resets dx and dy to initial values.

scale_options(plot_type=None, ax=None, field_type: str = None, field: str = None)[source]#

list : options for scaling the data.

sort_data(method)[source]#

Sorts analyte columns in the raw and processed data according to the specified method.

This method retrieves a list of analytes from the processed data DataFrame and reorders the columns in both raw and processed data based on the sorting strategy provided. The sorting is performed using an external function sort_analytes, which takes the user-defined method and the analyte list as inputs.

Parameters:

method (str) – Sorting method selected by the user. This is passed to sort_analytes and determines the order in which analytes are arranged (e.g., alphabetical, PCA loadings, cluster association, etc.).

Returns:

  • analyte_list (list) – the original list of analytes found in processed data.

  • sorted_analyte_list (list) – the list of analytes sorted according to the provided method.

swap_resolution()[source]#

Swaps DX and DY for a dataframe, updates X and Y

Recalculates X and Y for a dataframe

swap_xy()[source]#

Swaps data in a SampleObj.

transform_array(array, negative_method)[source]#

Negative and zero handling with clustering for noise detection.

Parameters:
  • array (numpy.ndarray) – Input data

  • negative_method (str) – Method for handling negative values

Returns:

Transformed data

Return type:

numpy.ndarray

update_norm(norm=None, field=None)[source]#

Update the norm of the data.

Parameters:
  • sample_id (str) – Sample identifier

  • norm (str, optional) – Data scale method linear or log, by default None

  • field (str, optional) – Field to change the norm, by default None

  • update (bool, optional) – Update the scale information of the data, by default False

update_resolution(axis, value)[source]#

Updates DX and DY for a dataframe

Recalculates X and Y for a dataframe when the user changes the value of pixel dimensions Dx or Dy

property valid_data_types#

data types possible for in processed data.

Type:

list

property x#

Value of x-coordinate associated with map data

Type:

numpy.ndarray

property x_range#

Range of pixels in x-direction.

Type:

float

property xlim#

(float, float) Limits of pixels in x-direction.

Type:

list

property y#

Value of y-coordinate associated with map data

Type:

numpy.ndarray

property y_range#

Range of pixels in y-direction.

Type:

float

property ylim#

(float, float) Limits of pixels in y-direction.

Type:

list

class common.DataHandling.XRFSampleObj(sample_id, file_path, outlier_method, negative_method, smoothing_method=None, ui=None)[source]#

Bases: SampleObj

Attributes:
apply_outlier_to_all

bool : flag that indicates whether the outlier method should be applied to all analytes.

array_size

tuple : (int, int) Size of map in pixels

aspect_ratio

float : Aspect ratio of maps (dy / dx).

auto_scale_value
crop_mask

numpy.ndarray: Boolean mask used to crop the raw data. True values will be used.

current_field

str :

data_max_diff_quantile

float : maximum quantile for differences used for autoscaling.

data_max_quantile

float : maximum quantile used for autoscaling.

data_min_diff_quantile

float : minimum quantile for differences used for autoscaling.

data_min_quantile

float : minimum quantile used for autoscaling.

dx

float : Width of pixels in x-direction.

dy

float : Width of pixels in y-direction.

negative_method

str : Method for negative handling.

nx
ny
outlier_method

str : Method for predicting and clipping outliers.

valid_data_types

list : data types possible for in processed data.

x

numpy.ndarray : Value of x-coordinate associated with map data

x_range

float : Range of pixels in x-direction.

xlim

list : (float, float) Limits of pixels in x-direction.

y

numpy.ndarray : Value of y-coordinate associated with map data

y_range

float : Range of pixels in y-direction.

ylim

list : (float, float) Limits of pixels in y-direction.

Methods

add_columns(data_type, column_names, array)

Add one or more columns to the sample object.

add_observer(event_name, callback)

Register a callback function to be called when a property changes.

apply_field_filters()

Applies filters based on field values.

auto_scale(sample_id, field[, update])

Auto-scales pixel values in map

clip_outliers(array, outlier_method[, pl, ...])

Attempts to remove outliers to by a method selected by the user.

cluster_data()

Clusters data for use with data preprocessing

compute_ratio(analyte_1, analyte_2)

Compute a ratio field from two analytes.

confirm_reset()

A simple dialog that ensures the user wishes to reset data

create_label(column_name)

Creates a default label for axes.

delete_column(column_name)

Deletes a column and associated attributes from the AttributeDataFrame.

get_map_data(field[, field_type, norm, ...])

Retrieves and processes the mapping data for the given sample and analytes

get_processed_data()

Gets the processed data for analysis

get_vector(field_type, field[, norm, processed])

Creates a dictionary of values for plotting

k_optimal_clusters(data[, max_clusters])

Predicts the optimal number of clusters.

notify_observers(event_name, *args, **kwargs)

Notify all registered observers of an event or property change.

prep_data([field])

Applies adjustments to data data prior to analyses and plotting.

remove_observer(event_name, callback)

Deregister a callback function from an event.

reset_crop()

Reset the data to the original bounds.

reset_data()

Reverts back to the original data.

reset_data_handling()

Resets processed data back to raw before performing autoscaling.

reset_resolution()

Resets dx and dy to initial values.

scale_options([plot_type, ax, field_type, field])

list : options for scaling the data.

sort_data(method)

Sorts analyte columns in the raw and processed data according to the specified method.

swap_resolution()

Swaps DX and DY for a dataframe, updates X and Y

swap_xy()

Swaps data in a SampleObj.

transform_array(array, negative_method)

Negative and zero handling with clustering for noise detection.

update_norm([norm, field])

Update the norm of the data.

update_resolution(axis, value)

Updates DX and DY for a dataframe

add_columns(data_type, column_names, array, mask=None)#

Add one or more columns to the sample object.

Adds one or more columns to SampleObj.processed. If a mask is provided, the data is placed in the correct rows based on the mask.

Parameters:
  • data_type (str) – The type of data stored in the columns.

  • column_names (str or list of str) – The name or names of the columns to add. If a column already exists, it will be overwritten.

  • array (numpy.ndarray) – A 1D array (for single column) or 2D array (for multiple columns). The data to be added.

  • mask (numpy.ndarray, optional) – A boolean mask that indicates which rows in the original data should be filled. If not provided, the length of array must match the height of processed data.

Returns:

Returns a message if a column is overwritten, or a dictionary with column names as keys and “overwritten” or “added” as values if multiple columns are added.

Return type:

dict or str

Raises:
  • ValueError – Valid types are given in SampleObj._valid_data_types.

  • ValueError – The number of columns in the array must match the length of column_names (if multiple columns are being added).

  • ValueError – The length of array must match the height of processed data if no mask is provided.

  • ValueError – If a mask is provided, its length must match the height of processed data, and the number of True values in the mask must match the number of rows in array.

add_observer(event_name: str, callback: Callable)#

Register a callback function to be called when a property changes.

apply_field_filters()#

Applies filters based on field values.

Field-based filters are stored in self.filter_df. This method updates self.filter_mask.

auto_scale(sample_id, field, update=False)#

Auto-scales pixel values in map

Executes on MainWindow.toolButtonAutoScale click.

Outliers can make it difficult to view the variations of values within a map. This is a larger problem for linear scales, but can happen when log-scaled. Auto- scaling the data clips the values at a lower and upper bound. Auto-scaling may be acceptable as minerals that were not specifically calibrated can have erroneously high or low (even negative) values.

Parameters:

update (bool) – Update auto scale parameters, by default, False

clip_outliers(array, outlier_method, pl=None, pu=None, dpl=None, dpu=None)#

Attempts to remove outliers to by a method selected by the user.

Parameters:
  • array (numpy.ndarray) – Data vector

  • outlier_method (str) – Method for removing outliers

  • pl (float, optional) – Lower percentile bound required by selected methods

  • pu (float, optional) – Upper percentile bound required by selected methods

  • dpl (float, optional) – Lower percentile bound for distances required by selected methods

  • dpu (float, optional) – Upper percentile bound for distances required by selected methods

Returns:

Clipped data vector

Return type:

numpy.ndarray

cluster_data()#

Clusters data for use with data preprocessing

_extended_summary_

compute_ratio(analyte_1, analyte_2)#

Compute a ratio field from two analytes.

Ratios are computed on the processed data, after negative handling, but before autoscaling.

Parameters:
  • analyte_1 (str) – Analyte field to be used as numerator of ratio.

  • analyte_2 (str) – Analyte field to be used as denominator of ratio.

confirm_reset()#

A simple dialog that ensures the user wishes to reset data

Returns:

True indicates user clicked Yes, False for No

Return type:

bool

create_label(column_name)#

Creates a default label for axes.

Creates a default label for axes on plots, using the column name in processed data.

Parameters:

column_name (str) – Column in processed data.

delete_column(column_name)#

Deletes a column and associated attributes from the AttributeDataFrame.

Parameters:

column_name (str) – Name of column to remove.

Raises:

ValueError – Raises an error if the column is not a member of the AttributeDataFrame.

get_map_data(field, field_type='Analyte', norm=False, processed=True)#

Retrieves and processes the mapping data for the given sample and analytes

The method also updates certain parameters in the analyte data frame related to scaling. Based on the plot type, this method internally calls the appropriate plotting functions.

Parameters:
  • field (str) – Name of field to plot. By default None.

  • field_type (str, optional) – Type of field to plot. Types include ‘Analyte’, ‘Ratio’, ‘PCA’, ‘Cluster’, ‘Cluster score’, ‘Special’, ‘Computed’. By default ‘Analyte’

  • norm (str) – Scale data as linear, log, etc. based on stored norm. If scale_data is False, the data are returned with a linear scale. By default False.

Returns:

Processed data for plotting. This is only returned if analysis_type is not ‘laser’ or ‘hist’.

Return type:

pandas.DataFrame

get_processed_data()#

Gets the processed data for analysis

Returns:

  • pandas.DataFrame – Filtered data frame

  • bool – Analytes included from processed data

get_vector(field_type, field, norm='linear', processed=True)#

Creates a dictionary of values for plotting

Returns:

Dictionary with array and additional relevant plot data, contains ‘field’, ‘type’, ‘label’, and ‘array’.

Return type:

dict

k_optimal_clusters(data, max_clusters=10)#

Predicts the optimal number of clusters.

Predicts the optimal number of k-means clusters using the elbow method based on the within-cluster sum of squares (WCSS):

\[WCSS = \sum_{i=1}^k \sum_{x \in C_i} (x - \mu_i)^2\]

The optimal number of clusters is determined by selecting the k-value corresponding to the maximum value of the second derivative of WCSS.

Parameters:
  • data (numpy.ndarray) – Data used in clustering. Make sure it has NaN and ±inf values removed.

  • max_clusters (int, optional) – Computes cluster results from 1 to max_clusters, by default 10.

Returns:

The optimal number of k-means clusters.

Return type:

int

notify_observers(event_name: str, *args, **kwargs)#

Notify all registered observers of an event or property change.

prep_data(field=None)#

Applies adjustments to data data prior to analyses and plotting.

This method applies a workflow to adjust data to limit the number of data that are otherwise unusable due to incorrect calibrations, particularly for low and high element concentration regions.

Data are adjusted according to the proceedure: | Determine optimal number of clusters and use it to classify the data using kmeans. | Transform each cluster, by handling negative data. The method of negative handling is set by MainWindow.comboBoxNegativeMethod.currentText(). | Compute ratios not imported (i.e., not in raw_data). | Determine outliers and limit their impact on analyses by clipping/autoscaling

These calculations start from the cropped data, but do not include chemical, polygonal, or cluster filtering.

Raises:

AssertionError – processed data has not yet been initialized. processed data should be created when the sample is initialized and prep_data is run for the first time.

remove_observer(event_name: str, callback: Callable)#

Deregister a callback function from an event.

reset_crop()#

Reset the data to the original bounds.

Reseting the data to the original bounds results in deleting progress on analyses, computations, etc.

reset_data()#

Reverts back to the original data.

What is reset?

What is not reset?

reset_data_handling()#

Resets processed data back to raw before performing autoscaling.

Any computed fields will be removed.

reset_resolution()#

Resets dx and dy to initial values.

scale_options(plot_type=None, ax=None, field_type: str = None, field: str = None)#

list : options for scaling the data.

sort_data(method)#

Sorts analyte columns in the raw and processed data according to the specified method.

This method retrieves a list of analytes from the processed data DataFrame and reorders the columns in both raw and processed data based on the sorting strategy provided. The sorting is performed using an external function sort_analytes, which takes the user-defined method and the analyte list as inputs.

Parameters:

method (str) – Sorting method selected by the user. This is passed to sort_analytes and determines the order in which analytes are arranged (e.g., alphabetical, PCA loadings, cluster association, etc.).

Returns:

  • analyte_list (list) – the original list of analytes found in processed data.

  • sorted_analyte_list (list) – the list of analytes sorted according to the provided method.

swap_resolution()#

Swaps DX and DY for a dataframe, updates X and Y

Recalculates X and Y for a dataframe

swap_xy()#

Swaps data in a SampleObj.

transform_array(array, negative_method)#

Negative and zero handling with clustering for noise detection.

Parameters:
  • array (numpy.ndarray) – Input data

  • negative_method (str) – Method for handling negative values

Returns:

Transformed data

Return type:

numpy.ndarray

update_norm(norm=None, field=None)#

Update the norm of the data.

Parameters:
  • sample_id (str) – Sample identifier

  • norm (str, optional) – Data scale method linear or log, by default None

  • field (str, optional) – Field to change the norm, by default None

  • update (bool, optional) – Update the scale information of the data, by default False

update_resolution(axis, value)#

Updates DX and DY for a dataframe

Recalculates X and Y for a dataframe when the user changes the value of pixel dimensions Dx or Dy

common.ExtendedDF module#

class common.ExtendedDF.AttributeDataFrame(data=None, *args, **kwargs)[source]#

Bases: DataFrame

Creates a pandas DataFrame with custom attributes stored with each column.

Create a dataframe with column attributes or add attributes to existing columns of a dataframe and methods to get and set them.

Parameters:

data (pandas.DataFrame) – Input dataframe, if none provided an empty dataframe can be created, defaults to None

attributes_to_dataframe :

Return selected attributes of all columns in the AttributeDataFrame as a new DataFrame

copy_columns :

Extract specified columns into a new AttributeDataFrame, preserving their attributes

match_attribute :

Returns a list of columns where a specific attribute matches the given value

match_attributes :

Returns a list of columns where each attribute matches its corresponding value.

get_attribute :

Get an attribute from an AttributeDataFrame given a column or set of columns

get_attribute_dict :

Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name.

is_attribute :

Checks to see if an attribute exists

set_attribute :

Set one or more values for columns of an attribute in an AttributeDataFrame

_set_attribute :

Set a single attribute in a column of an AttributeDataFrame

show_attributes :

Prints the attributes stored in the dataframe

sort_columns :

Sorts columns and attributes of an AttributeDataFrame object.

Returns:

Adds a dictionary column_attributes to a dataframe and the methods to add, set, and get column attributes and their values.

Return type:

AttributeDataFrame

Examples

Example 1: Creating the DataFrame with no initial data df = AttributeDataFrame() print(df) # Output: Empty DataFrame

# Adding data and attributes df[‘Temperature’] = [22, 23, 21] df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Temperature’, ‘average’, 22) df.set_attribute(‘Temperature’, ‘uncertainty’, 1)

print(df) print(df.get_attribute(‘Temperature’, ‘units’)) # Output: Celsius print(df.get_attribute(‘Temperature’, ‘average’)) # Output: 22 print(df.get_attribute(‘Temperature’, ‘uncertainty’)) # Output: 1

Example 2: Creating the DataFrame from an existing dataframe

#df = AttributeDataFrame(data, column_attributes=column_attributes)

# Accessing attributes using methods #print(df.get_attribute(‘Temperature’, ‘units’)) # Output: Celsius #print(df.get_attribute(‘Pressure’, ‘average’)) # Output: 101

# Setting new attributes #df.set_attribute(‘Temperature’, ‘range’, (20, 25)) #print(df.get_attribute(‘Temperature’, ‘range’)) # Output: (20, 25)

Attributes:
T

The transpose of the DataFrame.

at

Access a single value for a row/column label pair.

attrs

Dictionary of global attributes of this dataset.

axes

Return a list representing the axes of the DataFrame.

columns

The column labels of the DataFrame.

>>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
>>> df
     A  B
0    1  3
1    2  4
>>> df.columns
Index(['A', 'B'], dtype='object')
dtypes

Return the dtypes in the DataFrame.

empty

Indicator whether Series/DataFrame is empty.

flags

Get the properties associated with this pandas object.

iat

Access a single value for a row/column pair by integer position.

iloc

Purely integer-location based indexing for selection by position.

index

The index (row labels) of the DataFrame.

The index of a DataFrame is a series of labels that identify each row. The labels can be integers, strings, or any other hashable type. The index is used for label-based access and alignment, and can be accessed or modified using this attribute.

pandas.Index

The index labels of the DataFrame.

DataFrame.columns : The column labels of the DataFrame. DataFrame.to_numpy : Convert the DataFrame to a NumPy array.

>>> df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Aritra'],
...                    'Age': [25, 30, 35],
...                    'Location': ['Seattle', 'New York', 'Kona']},
...                   index=([10, 20, 30]))
>>> df.index
Index([10, 20, 30], dtype='int64')

In this example, we create a DataFrame with 3 rows and 3 columns, including Name, Age, and Location information. We set the index labels to be the integers 10, 20, and 30. We then access the index attribute of the DataFrame, which returns an Index object containing the index labels.

>>> df.index = [100, 200, 300]
>>> df
    Name  Age Location
100  Alice   25  Seattle
200    Bob   30 New York
300  Aritra  35    Kona

In this example, we modify the index labels of the DataFrame by assigning a new list of labels to the index attribute. The DataFrame is then updated with the new labels, and the output shows the modified DataFrame.

loc

Access a group of rows and columns by label(s) or a boolean array.

ndim

Return an int representing the number of axes / array dimensions.

shape

Return a tuple representing the dimensionality of the DataFrame.

size

Return an int representing the number of elements in this object.

style

Returns a Styler object.

values

Return a Numpy representation of the DataFrame.

Methods

abs()

Return a Series/DataFrame with absolute numeric value of each element.

add(other[, axis, level, fill_value])

Get Addition of dataframe and other, element-wise (binary operator add).

add_prefix(prefix[, axis])

Prefix labels with string prefix.

add_suffix(suffix[, axis])

Suffix labels with string suffix.

agg([func, axis])

Aggregate using one or more operations over the specified axis.

aggregate([func, axis])

Aggregate using one or more operations over the specified axis.

align(other[, join, axis, level, copy, ...])

Align two objects on their axes with the specified join method.

all([axis, bool_only, skipna])

Return whether all elements are True, potentially over an axis.

any(*[, axis, bool_only, skipna])

Return whether any element is True, potentially over an axis.

apply(func[, axis, raw, result_type, args, ...])

Apply a function along an axis of the DataFrame.

applymap(func[, na_action])

Apply a function to a Dataframe elementwise.

asfreq(freq[, method, how, normalize, ...])

Convert time series to specified frequency.

asof(where[, subset])

Return the last row(s) without any NaNs before where.

assign(**kwargs)

Assign new columns to a DataFrame.

astype(dtype[, copy, errors])

Cast a pandas object to a specified dtype dtype.

at_time(time[, asof, axis])

Select values at particular time of day (e.g., 9:30AM).

attributes_to_dataframe([attributes])

Return selected attributes of all columns in the AttributeDataFrame as a new DataFrame.

backfill(*[, axis, inplace, limit, downcast])

Fill NA/NaN values by using the next valid observation to fill the gap.

between_time(start_time, end_time[, ...])

Select values between particular times of the day (e.g., 9:00-9:30 AM).

bfill(*[, axis, inplace, limit, limit_area, ...])

Fill NA/NaN values by using the next valid observation to fill the gap.

bool()

Return the bool of a single element Series or DataFrame.

boxplot([column, by, ax, fontsize, rot, ...])

Make a box plot from DataFrame columns.

clip([lower, upper, axis, inplace])

Trim values at input threshold(s).

combine(other, func[, fill_value, overwrite])

Perform column-wise combine with another DataFrame.

combine_first(other)

Update null elements with value in the same location in other.

compare(other[, align_axis, keep_shape, ...])

Compare to another DataFrame and show the differences.

convert_dtypes([infer_objects, ...])

Convert columns to the best possible dtypes using dtypes supporting pd.NA.

copy([deep])

Make a copy of this object's indices and data.

copy_columns([columns])

Extract specified columns into a new AttributeDataFrame, preserving their attributes.

corr([method, min_periods, numeric_only])

Compute pairwise correlation of columns, excluding NA/null values.

corrwith(other[, axis, drop, method, ...])

Compute pairwise correlation.

count([axis, numeric_only])

Count non-NA cells for each column or row.

cov([min_periods, ddof, numeric_only])

Compute pairwise covariance of columns, excluding NA/null values.

cummax([axis, skipna])

Return cumulative maximum over a DataFrame or Series axis.

cummin([axis, skipna])

Return cumulative minimum over a DataFrame or Series axis.

cumprod([axis, skipna])

Return cumulative product over a DataFrame or Series axis.

cumsum([axis, skipna])

Return cumulative sum over a DataFrame or Series axis.

describe([percentiles, include, exclude])

Generate descriptive statistics.

diff([periods, axis])

First discrete difference of element.

div(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator truediv).

divide(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator truediv).

dot(other)

Compute the matrix multiplication between the DataFrame and other.

drop([labels, axis, index, columns, level, ...])

Drop specified labels from rows or columns.

drop_duplicates([subset, keep, inplace, ...])

Return DataFrame with duplicate rows removed.

droplevel(level[, axis])

Return Series/DataFrame with requested index / column level(s) removed.

dropna(*[, axis, how, thresh, subset, ...])

Remove missing values.

duplicated([subset, keep])

Return boolean Series denoting duplicate rows.

eq(other[, axis, level])

Get Equal to of dataframe and other, element-wise (binary operator eq).

equals(other)

Test whether two objects contain the same elements.

eval(expr, *[, inplace])

Evaluate a string describing operations on DataFrame columns.

ewm([com, span, halflife, alpha, ...])

Provide exponentially weighted (EW) calculations.

expanding([min_periods, axis, method])

Provide expanding window calculations.

explode(column[, ignore_index])

Transform each element of a list-like to a row, replicating index values.

ffill(*[, axis, inplace, limit, limit_area, ...])

Fill NA/NaN values by propagating the last valid observation to next valid.

fillna([value, method, axis, inplace, ...])

Fill NA/NaN values using the specified method.

filter([items, like, regex, axis])

Subset the dataframe rows or columns according to the specified index labels.

first(offset)

Select initial periods of time series data based on a date offset.

first_valid_index()

Return index for first non-NA value or None, if no non-NA value is found.

floordiv(other[, axis, level, fill_value])

Get Integer division of dataframe and other, element-wise (binary operator floordiv).

from_dict(data[, orient, dtype, columns])

Construct DataFrame from dict of array-like or dicts.

from_records(data[, index, exclude, ...])

Convert structured or record ndarray to DataFrame.

ge(other[, axis, level])

Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).

get(key[, default])

Get item from object for given key (ex: DataFrame column).

get_attribute(columns, attribute)

Get a single attribute from an AttributeDataFrame for one or more columns.

get_attribute_dict(attribute_name)

Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name.

groupby([by, axis, level, as_index, sort, ...])

Group DataFrame using a mapper or by a Series of columns.

gt(other[, axis, level])

Get Greater than of dataframe and other, element-wise (binary operator gt).

head([n])

Return the first n rows.

hist([column, by, grid, xlabelsize, xrot, ...])

Make a histogram of the DataFrame's columns.

idxmax([axis, skipna, numeric_only])

Return index of first occurrence of maximum over requested axis.

idxmin([axis, skipna, numeric_only])

Return index of first occurrence of minimum over requested axis.

infer_objects([copy])

Attempt to infer better dtypes for object columns.

info([verbose, buf, max_cols, memory_usage, ...])

Print a concise summary of a DataFrame.

insert(loc, column, value[, allow_duplicates])

Insert column into DataFrame at specified location.

interpolate([method, axis, limit, inplace, ...])

Fill NaN values using an interpolation method.

is_attribute(column, attribute)

Check if a given attribute exists for the specified column.

isetitem(loc, value)

Set the given value in the column with position loc.

isin(values)

Whether each element in the DataFrame is contained in values.

isna()

Detect missing values.

isnull()

DataFrame.isnull is an alias for DataFrame.isna.

items()

Iterate over (column name, Series) pairs.

iterrows()

Iterate over DataFrame rows as (index, Series) pairs.

itertuples([index, name])

Iterate over DataFrame rows as namedtuples.

join(other[, on, how, lsuffix, rsuffix, ...])

Join columns of another DataFrame.

keys()

Get the 'info axis' (see Indexing for more).

kurt([axis, skipna, numeric_only])

Return unbiased kurtosis over requested axis.

kurtosis([axis, skipna, numeric_only])

Return unbiased kurtosis over requested axis.

last(offset)

Select final periods of time series data based on a date offset.

last_valid_index()

Return index for last non-NA value or None, if no non-NA value is found.

le(other[, axis, level])

Get Less than or equal to of dataframe and other, element-wise (binary operator le).

lt(other[, axis, level])

Get Less than of dataframe and other, element-wise (binary operator lt).

map(func[, na_action])

Apply a function to a Dataframe elementwise.

mask(cond[, other, inplace, axis, level])

Replace values where the condition is True.

match_attribute(attribute, value)

Returns a list of columns where a specific attribute matches the given value.

match_attributes(attributes_dict)

Returns a list of columns where each attribute matches its corresponding value.

max([axis, skipna, numeric_only])

Return the maximum of the values over the requested axis.

mean([axis, skipna, numeric_only])

Return the mean of the values over the requested axis.

median([axis, skipna, numeric_only])

Return the median of the values over the requested axis.

melt([id_vars, value_vars, var_name, ...])

Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.

memory_usage([index, deep])

Return the memory usage of each column in bytes.

merge(right[, how, on, left_on, right_on, ...])

Merge DataFrame or named Series objects with a database-style join.

min([axis, skipna, numeric_only])

Return the minimum of the values over the requested axis.

mod(other[, axis, level, fill_value])

Get Modulo of dataframe and other, element-wise (binary operator mod).

mode([axis, numeric_only, dropna])

Get the mode(s) of each element along the selected axis.

mul(other[, axis, level, fill_value])

Get Multiplication of dataframe and other, element-wise (binary operator mul).

multiply(other[, axis, level, fill_value])

Get Multiplication of dataframe and other, element-wise (binary operator mul).

ne(other[, axis, level])

Get Not equal to of dataframe and other, element-wise (binary operator ne).

nlargest(n, columns[, keep])

Return the first n rows ordered by columns in descending order.

notna()

Detect existing (non-missing) values.

notnull()

DataFrame.notnull is an alias for DataFrame.notna.

nsmallest(n, columns[, keep])

Return the first n rows ordered by columns in ascending order.

nunique([axis, dropna])

Count number of distinct elements in specified axis.

pad(*[, axis, inplace, limit, downcast])

Fill NA/NaN values by propagating the last valid observation to next valid.

pct_change([periods, fill_method, limit, freq])

Fractional change between the current and a prior element.

pipe(func, *args, **kwargs)

Apply chainable functions that expect Series or DataFrames.

pivot(*, columns[, index, values])

Return reshaped DataFrame organized by given index / column values.

pivot_table([values, index, columns, ...])

Create a spreadsheet-style pivot table as a DataFrame.

plot

alias of PlotAccessor

pop(item)

Return item and drop from frame.

pow(other[, axis, level, fill_value])

Get Exponential power of dataframe and other, element-wise (binary operator pow).

prod([axis, skipna, numeric_only, min_count])

Return the product of the values over the requested axis.

product([axis, skipna, numeric_only, min_count])

Return the product of the values over the requested axis.

quantile([q, axis, numeric_only, ...])

Return values at the given quantile over requested axis.

query(expr, *[, inplace])

Query the columns of a DataFrame with a boolean expression.

radd(other[, axis, level, fill_value])

Get Addition of dataframe and other, element-wise (binary operator radd).

rank([axis, method, numeric_only, ...])

Compute numerical data ranks (1 through n) along axis.

rdiv(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator rtruediv).

reindex([labels, index, columns, axis, ...])

Conform DataFrame to new index with optional filling logic.

reindex_like(other[, method, copy, limit, ...])

Return an object with matching indices as other object.

rename([mapper, index, columns, axis, copy, ...])

Rename columns or index labels.

rename_axis([mapper, index, columns, axis, ...])

Set the name of the axis for the index or columns.

reorder_levels(order[, axis])

Rearrange index levels using input order.

replace([to_replace, value, inplace, limit, ...])

Replace values given in to_replace with value.

resample(rule[, axis, closed, label, ...])

Resample time-series data.

reset_index([level, drop, inplace, ...])

Reset the index, or a level of it.

rfloordiv(other[, axis, level, fill_value])

Get Integer division of dataframe and other, element-wise (binary operator rfloordiv).

rmod(other[, axis, level, fill_value])

Get Modulo of dataframe and other, element-wise (binary operator rmod).

rmul(other[, axis, level, fill_value])

Get Multiplication of dataframe and other, element-wise (binary operator rmul).

rolling(window[, min_periods, center, ...])

Provide rolling window calculations.

round([decimals])

Round a DataFrame to a variable number of decimal places.

rpow(other[, axis, level, fill_value])

Get Exponential power of dataframe and other, element-wise (binary operator rpow).

rsub(other[, axis, level, fill_value])

Get Subtraction of dataframe and other, element-wise (binary operator rsub).

rtruediv(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator rtruediv).

sample([n, frac, replace, weights, ...])

Return a random sample of items from an axis of object.

select_dtypes([include, exclude])

Return a subset of the DataFrame's columns based on the column dtypes.

sem([axis, skipna, ddof, numeric_only])

Return unbiased standard error of the mean over requested axis.

set_attribute(columns, attribute, values)

Set an attribute for one or more columns.

set_axis(labels, *[, axis, copy])

Assign desired index to given axis.

set_flags(*[, copy, allows_duplicate_labels])

Return a new object with updated flags.

set_index(keys, *[, drop, append, inplace, ...])

Set the DataFrame index using existing columns.

shift([periods, freq, axis, fill_value, suffix])

Shift index by desired number of periods with an optional time freq.

show_attributes([column])

Displays all attributes for a specific column or for the entire DataFrame.

skew([axis, skipna, numeric_only])

Return unbiased skew over requested axis.

sort_columns(sorted_columns)

Sorts columns and attributes of an AttributeDataFrame object.

sort_index(*[, axis, level, ascending, ...])

Sort object by labels (along an axis).

sort_values(by, *[, axis, ascending, ...])

Sort by the values along either axis.

sparse

alias of SparseFrameAccessor

squeeze([axis])

Squeeze 1 dimensional axis objects into scalars.

stack([level, dropna, sort, future_stack])

Stack the prescribed level(s) from columns to index.

std([axis, skipna, ddof, numeric_only])

Return sample standard deviation over requested axis.

sub(other[, axis, level, fill_value])

Get Subtraction of dataframe and other, element-wise (binary operator sub).

subtract(other[, axis, level, fill_value])

Get Subtraction of dataframe and other, element-wise (binary operator sub).

sum([axis, skipna, numeric_only, min_count])

Return the sum of the values over the requested axis.

swapaxes(axis1, axis2[, copy])

Interchange axes and swap values axes appropriately.

swaplevel([i, j, axis])

Swap levels i and j in a MultiIndex.

tail([n])

Return the last n rows.

take(indices[, axis])

Return the elements in the given positional indices along an axis.

to_clipboard(*[, excel, sep])

Copy object to the system clipboard.

to_csv([path_or_buf, sep, na_rep, ...])

Write object to a comma-separated values (csv) file.

to_dict([orient, into, index])

Convert the DataFrame to a dictionary.

to_excel(excel_writer, *[, sheet_name, ...])

Write object to an Excel sheet.

to_feather(path, **kwargs)

Write a DataFrame to the binary Feather format.

to_gbq(destination_table, *[, project_id, ...])

Write a DataFrame to a Google BigQuery table.

to_hdf(path_or_buf, *, key[, mode, ...])

Write the contained data to an HDF5 file using HDFStore.

to_html([buf, columns, col_space, header, ...])

Render a DataFrame as an HTML table.

to_json([path_or_buf, orient, date_format, ...])

Convert the object to a JSON string.

to_latex([buf, columns, header, index, ...])

Render object to a LaTeX tabular, longtable, or nested table.

to_markdown([buf, mode, index, storage_options])

Print DataFrame in Markdown-friendly format.

to_numpy([dtype, copy, na_value])

Convert the DataFrame to a NumPy array.

to_orc([path, engine, index, engine_kwargs])

Write a DataFrame to the ORC format.

to_parquet([path, engine, compression, ...])

Write a DataFrame to the binary parquet format.

to_period([freq, axis, copy])

Convert DataFrame from DatetimeIndex to PeriodIndex.

to_pickle(path, *[, compression, protocol, ...])

Pickle (serialize) object to file.

to_records([index, column_dtypes, index_dtypes])

Convert DataFrame to a NumPy record array.

to_sql(name, con, *[, schema, if_exists, ...])

Write records stored in a DataFrame to a SQL database.

to_stata(path, *[, convert_dates, ...])

Export DataFrame object to Stata dta format.

to_string([buf, columns, col_space, header, ...])

Render a DataFrame to a console-friendly tabular output.

to_timestamp([freq, how, axis, copy])

Cast to DatetimeIndex of timestamps, at beginning of period.

to_xarray()

Return an xarray object from the pandas object.

to_xml([path_or_buffer, index, root_name, ...])

Render a DataFrame to an XML document.

transform(func[, axis])

Call func on self producing a DataFrame with the same axis shape as self.

transpose(*args[, copy])

Transpose index and columns.

truediv(other[, axis, level, fill_value])

Get Floating division of dataframe and other, element-wise (binary operator truediv).

truncate([before, after, axis, copy])

Truncate a Series or DataFrame before and after some index value.

tz_convert(tz[, axis, level, copy])

Convert tz-aware axis to target time zone.

tz_localize(tz[, axis, level, copy, ...])

Localize tz-naive index of a Series or DataFrame to target time zone.

unstack([level, fill_value, sort])

Pivot a level of the (necessarily hierarchical) index labels.

update(other[, join, overwrite, ...])

Modify in place using non-NA values from another DataFrame.

value_counts([subset, normalize, sort, ...])

Return a Series containing the frequency of each distinct row in the Dataframe.

var([axis, skipna, ddof, numeric_only])

Return unbiased variance over requested axis.

where(cond[, other, inplace, axis, level])

Replace values where the condition is False.

xs(key[, axis, level, drop_level])

Return cross-section from the Series/DataFrame.

attributes_to_dataframe(attributes=None)[source]#

Return selected attributes of all columns in the AttributeDataFrame as a new DataFrame.

Parameters:

attributes (list, optional) – List of attributes to include in the resulting DataFrame. If None, all attributes will be included.

Returns:

DataFrame where each column corresponds to an original column in the AttributeDataFrame and each row corresponds to an attribute.

Return type:

pandas.DataFrame

Example

df = AttributeDataFrame({‘Temperature’: [22, 23, 21], ‘Pressure’: [101, 102, 100]}) df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Pressure’, ‘units’, ‘Pascal’) df.set_attribute(‘Temperature’, ‘average’, 22) df.set_attribute(‘Pressure’, ‘average’, 101)

# Get only the ‘units’ attribute attribute_df_units = df.attributes_to_dataframe(attributes=[‘units’]) print(attribute_df_units)

# Get both ‘units’ and ‘average’ attributes attribute_df_units_avg = df.attributes_to_dataframe(attributes=[‘units’, ‘average’]) print(attribute_df_units_avg)

copy_columns(columns=None)[source]#

Extract specified columns into a new AttributeDataFrame, preserving their attributes. If no columns are specified, all columns will be copied.

Parameters:

columns (list, optional) – List of column names to extract. If None or empty, all columns are extracted.

Returns:

A new AttributeDataFrame containing the selected columns and their attributes.

Return type:

AttributeDataFrame

Example

# Initialize an AttributeDataFrame df = AttributeDataFrame({‘Temperature’: [22, 23, 21], ‘Pressure’: [101, 102, 100]}) df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Pressure’, ‘units’, ‘Pascal’) df.set_attribute(‘Temperature’, ‘average’, 22) df.set_attribute(‘Pressure’, ‘average’, 101)

# Extract all columns if no columns are specified new_df_all = df.copy_columns() print(new_df_all) print(new_df_all.get_attribute(‘Temperature’, ‘units’)) # Output: Celsius print(new_df_all.get_attribute(‘Pressure’, ‘units’)) # Output: Pascal

get_attribute(columns, attribute)[source]#

Get a single attribute from an AttributeDataFrame for one or more columns.

Parameters:
  • columns (str or list of str) – Name or list of column names.

  • attribute (str) – Name of the attribute to retrieve.

Returns:

Attribute value(s). Returns a single value if one column is provided, otherwise returns a list of attribute values for multiple columns.

Return type:

any or list

Examples

df = AttributeDataFrame() df[‘Temperature’] = [22, 23, 21] df[‘Pressure’] = [101, 100, 102] df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Pressure’, ‘units’, ‘Pascal’)

# Single column print(df.get_attribute(‘Temperature’, ‘units’)) # Output: ‘Celsius’

# Multiple columns print(df.get_attribute([‘Temperature’, ‘Pressure’], ‘units’)) # Output: [‘Celsius’, ‘Pascal’]

get_attribute_dict(attribute_name)[source]#

Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name.

Parameters:

attribute_name (str) – Name of attribute within the edf.column_attributes dictionary.

Returns:

A dictionary with attribute_values and columns that match.

Return type:

dict

is_attribute(column, attribute)[source]#

Check if a given attribute exists for the specified column.

Parameters:
  • column (str) – The name of the column.

  • attribute (str) – The attribute to check for.

Returns:

True if the attribute exists for the column, False otherwise.

Return type:

bool

match_attribute(attribute, value)[source]#

Returns a list of columns where a specific attribute matches the given value.

Parameters:
  • attribute (str) – The attribute to search for.

  • value (any, list) – The value(s) to match.

Returns:

A list of column names that have the attribute set to the specified value.

Return type:

list

match_attributes(attributes_dict)[source]#

Returns a list of columns where each attribute matches its corresponding value.

Parameters:

attributes_dict (dict) – A dictionary where keys are attribute names and values are the corresponding values to match.

Returns:

A list of column names where each attribute matches its corresponding value.

Return type:

list

set_attribute(columns, attribute, values)[source]#

Set an attribute for one or more columns.

Parameters:
  • columns (str or list) – A single column name or a list of column names.

  • attribute (str) – The name of the attribute to set.

  • values (any or list) – A single value to apply to all columns or a list of values for each column.

Raises:

ValueError – If the length of columns and values don’t match when values is a list.

Examples

# Single column, single attribute value df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’)

# Multiple columns, same attribute value df.set_attribute([‘Temperature’, ‘Pressure’], ‘source’, ‘Sensor’)

# Multiple columns, different attribute values df.set_attribute([‘Temperature’, ‘Pressure’], ‘units’, [‘Celsius’, ‘Pascal’])

show_attributes(column=None)[source]#

Displays all attributes for a specific column or for the entire DataFrame.

sort_columns(sorted_columns)[source]#

Sorts columns and attributes of an AttributeDataFrame object.

Parameters:

sorted_columns (list of str) – List of selected new column order

Returns:

For chaining methods.

Return type:

self

common.Logger module#

common.Masking module#

class common.Masking.ClusterTab(parent)[source]#

Bases: object

Methods

cluster_color_callback()

Updates color of a cluster

select_cluster_group_callback()

Set cluster color button background after change of selected cluster group

set_default_cluster_colors(style_data, ...)

Sets cluster group to default colormap

update_clusters()

Executed on update to cluster table.

cluster_label_changed

toggle_cluster_actions

update_table_widget

cluster_color_callback()[source]#

Updates color of a cluster

Uses QColorDialog to select new cluster color and then updates plot on change of backround self.toolButtonClusterColor color. Also updates self.tableWidgetViewGroups color associated with selected cluster. The selected cluster is determined by self.spinBoxClusterGroup.value()

cluster_label_changed(item)[source]#
select_cluster_group_callback()[source]#

Set cluster color button background after change of selected cluster group

Sets MainWindow.toolButtonClusterColor background on change of MainWindow.spinBoxClusterGroup

set_default_cluster_colors(style_data, cluster_tab, mask=False)[source]#

Sets cluster group to default colormap

Sets the colors in self.tableWidgetViewGroups to the default colormap in self.styles['cluster']['Colormap'].  Change the default colormap by changing ``self.comboBoxColormap, when self.comboBoxFieldTypeC.currentText() is Cluster.

Returns:

str

Return type:

hexcolor

toggle_cluster_actions()[source]#
update_clusters()[source]#

Executed on update to cluster table.

Updates MainWindow.cluster_dict and plot when the selected cluster have changed.

update_table_widget()[source]#
class common.Masking.FilterTab(parent)[source]#

Bases: object

Methods

apply_field_filters_update_plot()

Updates filters in self.parent.data for given sample_id

callback_doubleSpinBoxFMaxQ()

Updates MainWindow.lineEditFMax.value when MainWindow.doubleSpinBoxFMaxQ.value is changed

callback_doubleSpinBoxFMinQ()

Updates MainWindow.lineEditFMin.value when MainWindow.doubleSpinBoxFMinQ.value is changed

callback_lineEditFMax()

Updates MainWindow.doubleSpinBoxFMaxQ.value when MainWindow.lineEditFMax.value is changed

callback_lineEditFMin()

Updates self.doubleSpinBoxFMinQ.value when self.lineEditFMin.value is changed

load_filter_tables()

Loads filter names and adds them to the filter presets comboBox

remove_selected_rows()

Remove selected rows from filter table.

save_filter_table()

Opens a dialog to save filter table

update_filter_table([reload])

Update data for analysis when fiter table is updated.

update_filter_values(*args, **kwargs)

Updates widgets that display the filter bounds for a selected field.

read_filter_table

apply_field_filters_update_plot()[source]#

Updates filters in self.parent.data for given sample_id

Updates the plot once filter values have been update

callback_doubleSpinBoxFMaxQ()[source]#

Updates MainWindow.lineEditFMax.value when MainWindow.doubleSpinBoxFMaxQ.value is changed

callback_doubleSpinBoxFMinQ()[source]#

Updates MainWindow.lineEditFMin.value when MainWindow.doubleSpinBoxFMinQ.value is changed

callback_lineEditFMax()[source]#

Updates MainWindow.doubleSpinBoxFMaxQ.value when MainWindow.lineEditFMax.value is changed

callback_lineEditFMin()[source]#

Updates self.doubleSpinBoxFMinQ.value when self.lineEditFMin.value is changed

load_filter_tables()[source]#

Loads filter names and adds them to the filter presets comboBox

Looks for saved filter tables (*.fltr) in resources/filters/ directory and adds them to self.comboBoxFilterPresets.

read_filter_table()[source]#
remove_selected_rows()[source]#

Remove selected rows from filter table.

Removes selected rows from MainWindow.tableWidgetFilter.

save_filter_table()[source]#

Opens a dialog to save filter table

Executes on MainWindow.toolButtonFilterSave is clicked. The filter is added to MainWindow.tableWidgetFilters and save into a dictionary to a file with a .fltr extension.

update_filter_table(reload=False)[source]#

Update data for analysis when fiter table is updated.

Parameters:

reload (bool, optional) – Reload True updates the filter table, by default False

update_filter_values(*args, **kwargs)[source]#

Updates widgets that display the filter bounds for a selected field.

Updates self.lineEditFMin and self.lineEditFMax values for display when the field in self.comboBoxFilterField is changed.

class common.Masking.MaskDock(parent=None, title='Masking Toolbox')[source]#

Bases: CustomDockWidget, FieldLogicUI

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

allowedAreas(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Override the default close event to hide the dock widget instead of closing it.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

features(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAreaAllowed(self, area)

isEnabled(self)

isEnabledTo(self, a0)

isFloating(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, event)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllowedAreas(self, areas)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFeatures(self, features)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFloating(self, floating)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTitleBarWidget(self, widget)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWidget(self, widget)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

titleBarWidget(self)

toggleViewAction(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_data(data)

Updates the data

update_field_combobox(parentBox, childBox, ...)

Updates comboBoxes with fields for plots or analysis

update_field_type_combobox(comboBox[, ...])

Updates field type combobox

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockWidgetFeature

PaintDeviceMetric

RenderFlag

allowedAreasChanged

customContextMenuRequested

destroyed

dockLocationChanged

featuresChanged

objectNameChanged

topLevelChanged

update_tab_widget

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

closeEvent(event)#

Override the default close event to hide the dock widget instead of closing it.

This prevents the widget from being destroyed and allows it to be shown again later via widget.show().

Parameters:

event (QEvent) – The close event triggered by the user action.

update_data(data)#

Updates the data

Parameters:

data (AttributeDataFrame) – New data frame

update_field_combobox(parentBox, childBox, *args, **kwargs)#

Updates comboBoxes with fields for plots or analysis

Updates lists of fields in comboBoxes that are used to generate plots or used for analysis. Calls MainWindow.get_field_list() to construct the list.

Parameters:
  • parentBox (QComboBox, None) – ComboBox used to select field type (‘Analyte’, ‘Analyte (normalized)’, ‘Ratio’, etc.), if None, then ‘Analyte’

  • childBox (QComboBox) – ComboBox with list of field values

update_field_type_combobox(comboBox, addNone=False, plot_type='')#

Updates field type combobox

Used to update MainWindow.comboBoxHistFieldType, MainWindow.comboBoxFilterFieldType, MainWindow.comboBoxFieldTypeX, MainWindow.comboBoxFieldTypeY, MainWindow.comboBoxFieldTypeZ, and MainWindow.comboBoxColorByField

Parameters:
  • combobox (QComboBox) – The combobox to update.

  • addNone (bool) – Adds None to the top of the combobox list

  • plot_type (str) – The plot type helps to define the set of field types available, by default '' (no change)

update_tab_widget(*args, **kwargs)[source]#
class common.Masking.MaskObj(initial_value=None)[source]#

Bases: object

Attributes:
value

Methods

register_callback

register_callback(callback)[source]#
property value#
class common.Masking.PolygonTab(parent)[source]#

Bases: object

Methods

apply_polygon_mask([update_plot])

Creates the polygon mask for masking data

toggle_edge_detection()

Toggles edge detection to the current laser map plot.

toggle_polygon_actions()

Toggle enabled state of polygon actions based on self.polygon_toggle checked state.

update_table_widget(*args, **kwargs)

Update the polygon table (PyQt6 version).

view_selected_polygon()

View the selected polygon when a selection is made in the table widget .

polygon_state_changed

apply_polygon_mask(update_plot=True)[source]#

Creates the polygon mask for masking data

Updates MainWindow.data[sample_id].polygon_mask and if update_plot==True, updates MainWindow.data[sample_id].mask.

Parameters:

update_plot (bool, optional) – If true, calls MainWindow.apply_filters which also calls MainWindow.update_SV, by default True

polygon_state_changed()[source]#
toggle_edge_detection()[source]#

Toggles edge detection to the current laser map plot.

Executes on change of self.comboBoxEdgeDetectMethod when self.toolButtonEdgeDetect is checked.

toggle_polygon_actions()[source]#

Toggle enabled state of polygon actions based on self.polygon_toggle checked state.

update_table_widget(*args, **kwargs)[source]#

Update the polygon table (PyQt6 version).

view_selected_polygon()[source]#

View the selected polygon when a selection is made in the table widget .

common.MolecularWeightCalculator module#

Created on Thu Nov 30 15:55:16 2023

@author: a1904121

class common.MolecularWeightCalculator.MolecularWeightCalculator[source]#

Bases: object

Methods

molecular_weight

molecular_weight(formula)[source]#

common.NoteTaking module#

common.Polygon module#

class common.Polygon.Polygon(p_id)[source]#

Bases: object

class common.Polygon.PolygonManager(parent, main_window, logger_options=None, logger_key=None)[source]#

Bases: object

Operations related to polygon generation and manipulation

Polygons can be used to select or exclude regions of maps for analysis.

increment_pid()[source]#

creates a new polygon pid for addressing polygon when toolButtonPolyCreate is checked

plot_polygon_scatter:
distance_to_line_segment:
show_polygon_lines:
update_table_widget:

Methods

clear_plot()

Clear all existing polygons from the plot.

distance_to_line_segment(px, py, x1, y1, x2, y2)

Computes distance to the line segment of a polygon

extract_scatter_plot_state(scatter)

Extract the state of a scatter plot item

increment_pid()

Creates a new polygon ID

load_polygons(project_dir, sample_id)

Load polygons from a file

plot_existing_polygon(plot[, p_id])

Plot the first existing polygon for the current sample ID.

reconstruct_polygon(serializable_polygon)

Reconstruct a polygon from a serializable format

recreate_scatter_plot(state)

Recreate a scatter plot item from a saved state

save_polygons(project_dir, sample_id)

Save polygons to a file

transform_polygon_for_pickling(polygon)

Transform the polygon into a serializable format

update_table_widget()

Update the polygon table

view_selected_polygon()

View the selected polygon when a selection is made in the table widget.

add_samples

clear_lines

clear_polygons

plot_polygon_scatter

show_polygon_lines

add_samples()[source]#
clear_lines()[source]#
clear_plot()[source]#

Clear all existing polygons from the plot.

clear_polygons()[source]#
distance_to_line_segment(px, py, x1, y1, x2, y2)[source]#

Computes distance to the line segment of a polygon

Determines the minimum distance from a point (px,py) to a line segment defined by the points (x1,y1) and (x2,y2).

Parameters:
  • px (float) – Point used to determine minimum distance

  • py (float) – Point used to determine minimum distance

  • x1 (float) – Point 1 on a line

  • y1 (float) – Point 1 on a line

  • x2 (float) – Point 2 on a line

  • y2 (float) – Point 2 on a line

Returns:

Minimum distance from point to a line

Return type:

float

extract_scatter_plot_state(scatter)[source]#

Extract the state of a scatter plot item

increment_pid()[source]#

Creates a new polygon ID

load_polygons(project_dir, sample_id)[source]#

Load polygons from a file

plot_existing_polygon(plot, p_id=None)[source]#

Plot the first existing polygon for the current sample ID.

If there are polygons for the sample ID, select the row in the table widget and plot the first polygon with its points and lines.

plot_polygon_scatter(event, k, x, y, x_i, y_i)[source]#
reconstruct_polygon(serializable_polygon)[source]#

Reconstruct a polygon from a serializable format

recreate_scatter_plot(state)[source]#

Recreate a scatter plot item from a saved state

save_polygons(project_dir, sample_id)[source]#

Save polygons to a file

show_polygon_lines(x, y, complete=False)[source]#
transform_polygon_for_pickling(polygon)[source]#

Transform the polygon into a serializable format

update_table_widget()[source]#

Update the polygon table

view_selected_polygon()[source]#

View the selected polygon when a selection is made in the table widget.

common.PolygonMatplotlib module#

class common.PolygonMatplotlib.InteractivePolygon(ax, verts)[source]#

Bases: object

Methods

add_vertex

deselect

move_vertex

remove

remove_vertex

select

add_vertex(insert_after_idx, xy)[source]#
deselect()[source]#
move_vertex(idx, new_xy)[source]#
remove()[source]#
remove_vertex(idx)[source]#
select()[source]#
class common.PolygonMatplotlib.PolygonManager(parent, main_window)[source]#

Bases: object

Methods

clear_polygons()

Clear all existing polygons from the plot.

increment_pid()

Creates a new polygon ID

plot_existing_polygon(canvas[, p_id])

Plot the first (or specified) existing polygon for the current sample ID.

start_polygon(canvas)

Start polygon drawing for a particular sample_id.

add_samples

deselect_all

disconnect

enable_connections

finish_polygon

initiate_axes

load_polygons

onclick

onkey

onmove

onrelease

save_polygons

add_samples()[source]#
clear_polygons()[source]#

Clear all existing polygons from the plot.

deselect_all()[source]#
disconnect()[source]#
enable_connections()[source]#
finish_polygon()[source]#
increment_pid()[source]#

Creates a new polygon ID

initiate_axes(canvas)[source]#
load_polygons(project_dir, sample_id)[source]#
onclick(event)[source]#
onkey(event)[source]#
onmove(event)[source]#
onrelease(event)[source]#
plot_existing_polygon(canvas, p_id=None)[source]#

Plot the first (or specified) existing polygon for the current sample ID.

  • Selects the row in the table widget for the polygon.

  • Plots the polygon patch and, if present, the vertex scatter points.

save_polygons(project_dir, sample_id)[source]#
start_polygon(canvas)[source]#

Start polygon drawing for a particular sample_id.

class common.PolygonMatplotlib.SerializablePolygon(p_id, verts, color='b', alpha=0.3)[source]#

Bases: object

common.Regression module#

class common.Regression.RegressionDock(page_index, parent=None)[source]#

Bases: CustomDockWidget

Regression analysis page for the toolbox.

This page allows users to select regression methods, configure outlier detection, and tune model parameters. It is designed to be used within a QToolBox in the main application window.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

allowedAreas(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Override the default close event to hide the dock widget instead of closing it.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

features(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAreaAllowed(self, area)

isEnabled(self)

isEnabledTo(self, a0)

isFloating(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, event)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllowedAreas(self, areas)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFeatures(self, features)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFloating(self, floating)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTitleBarWidget(self, widget)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWidget(self, widget)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

titleBarWidget(self)

toggleViewAction(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockWidgetFeature

PaintDeviceMetric

RenderFlag

allowedAreasChanged

customContextMenuRequested

destroyed

dockLocationChanged

featuresChanged

objectNameChanged

topLevelChanged

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

common.reSTEdit module#

common.reSTNotes module#

class common.reSTNotes.NoteOptionsDialog(parent=None)[source]#

Bases: QDialog

Opens when Notes.action_options is triggered.

Opens a dialog to change options associated with Notes formatting options.

Parameters:

parent (Notes, optional) – Notes class used to call this dialog, by default None

Methods

accept(self)

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

done(self, a0)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

exec(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

get_options()

Returns the options set in the dialog.

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isSizeGripEnabled(self)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

open(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

reject(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

result(self)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setModal(self, modal)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setResult(self, r)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeGripEnabled(self, a0)

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_maxcolumns()

Updates maximum number of columns option

update_maxvariance()

Updates maximum variance option

update_options_dict()

Updates notes option dictionary upon accept

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DialogCode

PaintDeviceMetric

RenderFlag

accepted

customContextMenuRequested

destroyed

finished

objectNameChanged

rejected

windowIconChanged

windowIconTextChanged

windowTitleChanged

get_options()[source]#

Returns the options set in the dialog.

update_maxcolumns()[source]#

Updates maximum number of columns option

update_maxvariance()[source]#

Updates maximum variance option

update_options_dict()[source]#

Updates notes option dictionary upon accept

class common.reSTNotes.NotesDock(parent: QMainWindow = None, filename: str | Path | None = None, title: str = 'reST Editor')[source]#

Bases: CustomDockWidget

A dock that can be used to take notes in ReStructured Text (ReST) including formatted output.

Notes are automatically saved at regular intervals and upon close of the dock. The toolbar includes functions that format selected text into ReST format. There are also options for preformatted output of data and analyses. Tables, and figures can be added, though not viewed in the notes until compiled. With rst2pdf installed, the notes will be compiled into a PDF file. Equations can be added in LaTeX format for nice formatting.

Parameters:
  • parent (MainWindow, optional) – Parent UI, by default None

  • filename (str, optional) – Filename for saving notes, by default None

  • title (str, optional) – Title for Notes dockwidget, by default ‘Notes’

Raises:

TypeError – Parent must be an instance of QMainWindow.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

allowedAreas(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, event)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Override the default close event to hide the dock widget instead of closing it.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

features(self)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

initStyleOption(self, option)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAreaAllowed(self, area)

isEnabled(self)

isEnabledTo(self, a0)

isFloating(self)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, event)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAllowedAreas(self, areas)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFeatures(self, features)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFloating(self, floating)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setTitleBarWidget(self, widget)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWidget(self, widget)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

titleBarWidget(self)

toggleViewAction(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

widget(self)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockWidgetFeature

PaintDeviceMetric

RenderFlag

allowedAreasChanged

customContextMenuRequested

destroyed

dockLocationChanged

featuresChanged

objectNameChanged

topLevelChanged

visibilityChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

class common.reSTNotes.NotesFormatter[source]#

Bases: object

Methods

format

format_dict

format_list

format_string

format(data) str[source]#
format_dict(d: dict, indent: int = 0) str[source]#
format_list(items: list, indent: int = 0) str[source]#
format_string(text: str) str[source]#
class common.reSTNotes.NotesMainWindow[source]#

Bases: QMainWindow

A reSTructuredText editor built with PyQt6

This is the main window environment for the reST Notes editor.

Seealso:

NotesWidget

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

addDockWidget(addDockWidget)

addToolBar(-> None)

addToolBarBreak(self[, area])

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

centralWidget(self)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, event)

contextMenuPolicy(self)

corner(self, corner)

create(self[, window, initializeWindow, ...])

createPopupMenu(self)

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dockOptions(self)

dockWidgetArea(self, dockwidget)

documentMode(self)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, event)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

iconSize(self)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

insertToolBar(self, before, toolbar)

insertToolBarBreak(self, before)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isAnimated(self)

isDockNestingEnabled(self)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSeparator(self, pos)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

menuBar(self)

menuWidget(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeDockWidget(self, dockwidget)

removeEventFilter(self, a0)

removeToolBar(self, toolbar)

removeToolBarBreak(self, before)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeDocks(self, docks, sizes, orientation)

resizeEvent(self, a0)

restoreDockWidget(self, dockwidget)

restoreGeometry(self, geometry)

restoreState(self, state[, version])

saveGeometry(self)

saveState(self[, version])

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAnimated(self, enabled)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setCentralWidget(self, widget)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCorner(self, corner, area)

setCursor(self, a0)

setDisabled(self, a0)

setDockNestingEnabled(self, enabled)

setDockOptions(self, options)

setDocumentMode(self, enabled)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setIconSize(self, iconSize)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMenuBar(self, menubar)

setMenuWidget(self, menubar)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusBar(self, statusbar)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabPosition(self, areas, tabPosition)

setTabShape(self, tabShape)

setTabletTracking(self, enable)

setToolButtonStyle(self, toolButtonStyle)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUnifiedTitleAndToolBarOnMac(self, set)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

splitDockWidget(self, after, dockwidget, ...)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusBar(self)

statusTip(self)

style(self)

styleSheet(self)

tabPosition(self, area)

tabShape(self)

tabifiedDockWidgets(self, dockwidget)

tabifyDockWidget(self, first, second)

tabletEvent(self, a0)

takeCentralWidget(self)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolBarArea(self, toolbar)

toolBarBreak(self, toolbar)

toolButtonStyle(self)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unifiedTitleAndToolBarOnMac(self)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

DockOption

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

iconSizeChanged

objectNameChanged

tabifiedDockWidgetActivated

toolButtonStyleChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

class common.reSTNotes.NotesTab(tab_widget: QTabWidget, filename: str | Path | None = None, title: str = 'reST Editor')[source]#

Bases: QWidget

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

class common.reSTNotes.NotesWidget(ui=None, filename: str | Path | None = None)[source]#

Bases: QWidget

Attributes:
info_menu_items

list[tuple[str, Callable]]: The list of tuples defining the info menu items.

notes_file

Path : File name associated with the current sample.

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

add_info_menu_item(label, callback)

Add a single menu item to the info menu.

add_menu(menu_items, menu_obj)

Adds items to a context menu

add_table_note(matrix[, row_labels, col_labels])

Convert matrix to restructured text

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

close(self)

closeEvent(event)

Override closeEvent to execute custom logic when the dock widget closes.

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

format_citation(cursor, key)

Formats and appends citation under References section.

format_header(level)

Formats a selected line as a header

format_hyperlink(cursor[, key, url])

Formats and inserts a hyperlink definition.

format_list(list_type[, list_style])

Formats a list in the text, either bulleted or enumerated

format_text(style)

Formats the text

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

insert_image([filename, halign, width, ...])

Adds a generic placeholder image to notes

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

open_note_options()

Opens the note options dialog.

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

remove_info_menu_item(label)

Remove a single item from the info menu.

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

save_notes_file()

Saves notes to an *.rst file

save_notes_to_pdf()

Converts notes *.rst file to *.pdf

screen(self)

scroll(scroll)

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

to_rst_table(df)

Converts a Pandas DataFrame to a reST table string.

toggleWrap(state)

Toggles word wrapping in text editing widget.

toggle_preview_notes()

Shows/hides the PDF preview browser

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_notes_view()

Compiles the .rst file to HTML and displays it in QWebEngineView.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

connect_widgets

customContextMenuRequested

destroyed

objectNameChanged

print_info

setupUI

update_equation_menu

windowIconChanged

windowIconTextChanged

windowTitleChanged

write_equation

add_info_menu_item(label: str, callback)[source]#

Add a single menu item to the info menu.

If self.action_info is not on the toolbar, then it is added.

Parameters:
  • label (str) – The menu label to add

  • callback (Callable) – The menu callback

add_menu(menu_items, menu_obj)[source]#

Adds items to a context menu

Parameters:
  • menu_items (list) – Names of the menu text to add

  • menu_obj (menu_obj) – context menu object

add_table_note(matrix, row_labels=None, col_labels=None)[source]#

Convert matrix to restructured text

Adds a table to the note tab, including row lables and column headers.

Parameters:
  • matrix (2D array) – Data for printing

  • row_labels (str, optional) – Row labels

  • col_labels (str, optional) – Column header

closeEvent(event)[source]#

Override closeEvent to execute custom logic when the dock widget closes.

connect_widgets()[source]#
format_citation(cursor, key)[source]#

Formats and appends citation under References section.

Creates a citation at the current location, using the selected text as the citation key and then creates an empty referenence in the reference list a the bottom of the document. Creates an empty reference at the current location and an empty citation at the end of the reference list if no text is selected. If no Reference section exists, it will be created.

Parameters:
  • cursor (QCursor) – defined by self.editor.textCursor()

  • key (str) – selected text to be used for the citation key

format_header(level)[source]#

Formats a selected line as a header

Places a symbol consistent with the heading level below the selected text line.

Parameters:

level (str) – The header level is determined from a context menu associated with MainWindow.toolButtonNotesHeading

Formats and inserts a hyperlink definition.

Ensures the hyperlink is placed above the References section if it exists, or at the end of the document if it doesn’t.

Parameters:
  • cursor (QCursor) – defined by self.editor.textCursor()

  • key (str) – selected text to be used for the citation key

  • url (str) – inserts the url into the hyperlink

format_list(list_type, list_style=None)[source]#

Formats a list in the text, either bulleted or enumerated

Formats selected text as bulleted or enumerated in restructured text format.

Parameters:
  • list_type (str) – Type of formatting, bullet or enumerate

  • list_style (str) – Style or symbol for formatting list

format_text(style)[source]#

Formats the text

Formats selected text as bold, italic or literal in restructured text format.

Parameters:

style (str) – Type of formatting, options include: bold, italic, literal, subscript, superscript, inline math, display math, citation, and hyperlink

property info_menu_items#

The list of tuples defining the info menu items.

Each tuple should contain two elements:
  • label (str): The text label to display in the menu.

  • callback (Callable): The function to be called when the menu item is triggered.

If self._info_menu_items is empty, then the action is removed from the toolbar.

This property reflects the menu items shown under the “Formatted Info” button.

Type:

list[tuple[str, Callable]]

insert_image(filename=None, halign='center', width=150, alt_text=None, caption=None)[source]#

Adds a generic placeholder image to notes

Uses the reStructured Text figure format

Parameters:

filenames (list of str) – A list of filenames to add images

property notes_file#

File name associated with the current sample. When set, the current file will be saved before changing files. If the new file name is not None, an autosave timer will be set.

Type:

Path

open_note_options()[source]#

Opens the note options dialog.

print_info(info_data)[source]#
remove_info_menu_item(label)[source]#

Remove a single item from the info menu.

If self._info_menu_items is empty after removing the last menu item, then the action is removed from the toolbar.

Parameters:

label (str) – Text label of menu item to remove.

save_notes_file()[source]#

Saves notes to an *.rst file

Autosaves the notes to a file [sample_id].rst

save_notes_to_pdf()[source]#

Converts notes *.rst file to *.pdf

setupUI()[source]#
to_rst_table(df)[source]#

Converts a Pandas DataFrame to a reST table string.

Parameters:

df (pandas.DataFrame) – Data table to convert to restructured text

Returns:

Table in restructred text format

Return type:

str

toggleWrap(state)[source]#

Toggles word wrapping in text editing widget.

Parameters:

state (bool) – True turns wrapping on

toggle_preview_notes()[source]#

Shows/hides the PDF preview browser

update_equation_menu()[source]#
update_notes_view()[source]#

Compiles the .rst file to HTML and displays it in QWebEngineView.

write_equation(equation)[source]#
common.reSTNotes.convert_rst_to_html(rst_path: Path) Path[source]#

Converts an rst file to html given a file path.

Parameters:

rst_path (Posix.path) – Path to rst file

Returns:

html_path – Path to compiled html file as a str.

Return type:

str

common.reSTRules module#

class common.reSTRules.HighlightRule(name: str, foreground: str = '#5c6167', background: str = None, font_family: str = None, font_weight: str = 'normal', font_italic: bool = False, underline: bool = False)[source]#

Bases: object

Methods

from_dict

to_dict

classmethod from_dict(data)[source]#
to_dict()[source]#

common.ScheduleTimer module#

class common.ScheduleTimer.Scheduler(parent=None, callback=None, delay=300)[source]#

Bases: QObject

Scheduler sets a timer once an action is triggered and can be use to delay actions until all desired actions are complete.

Parameters:

QObject (QObject) – Creates a pyqt object.

timeout#

Signals when timer has expired.

Type:

pyqtSignal

Examples

  1. Scheduler for plot updates

self.scheduler = Scheduler(callback=self.*method*)

self.*widget1*.*signal*.connect(self.scheduler.schedule_update) self.*widget2*.*signal*.connect(self.scheduler.schedule_update)

  1. Scheduler with signal

self.scheduler = Scheduler() self.scheduler.timeout.connect(self.on_timeout)

self.*widget*.*signal*.connect(self.scheduler.schedule_update)

Methods

blockSignals(self, b)

childEvent(self, a0)

children(self)

connectNotify(self, signal)

customEvent(self, a0)

deleteLater(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, a0)

eventFilter(self, a0, a1)

findChild(-> QObjectT)

findChildren(...)

inherits(self, classname)

installEventFilter(self, a0)

isQuickItemType(self)

isSignalConnected(self, signal)

isWidgetType(self)

isWindowType(self)

is_active()

Check if the timer is currently running.

killTimer(self, id)

metaObject(self)

moveToThread(self, thread)

objectName(self)

parent(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, signal)

removeEventFilter(self, a0)

reset_timer()

Restart timer with same delay.

schedule_update()

Start or restart the timer.

sender(self)

senderSignalIndex(self)

setObjectName(self, name)

setParent(self, a0)

setProperty(self, name, value)

set_delay(delay)

Set the debounce delay dynamically.

signalsBlocked(self)

startTimer(self, interval[, timerType])

stop()

Stop the timer if it's running.

thread(self)

timerEvent(self, a0)

tr(sourceText[, disambiguation, n])

destroyed

objectNameChanged

timeout

Initializes Scheduler.

Use a scheduler to delay updates when multiple actions are performed.

Parameters:
  • parent (QObject, optional) – UI window, by default None

  • callback (Callable[[], None], optional) – Method executed when timer expires, by default None

  • delay (int, optional) – Scheduler delay, by default 300

Methods

blockSignals(self, b)

childEvent(self, a0)

children(self)

connectNotify(self, signal)

customEvent(self, a0)

deleteLater(self)

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

event(self, a0)

eventFilter(self, a0, a1)

findChild(-> QObjectT)

findChildren(...)

inherits(self, classname)

installEventFilter(self, a0)

isQuickItemType(self)

isSignalConnected(self, signal)

isWidgetType(self)

isWindowType(self)

is_active()

Check if the timer is currently running.

killTimer(self, id)

metaObject(self)

moveToThread(self, thread)

objectName(self)

parent(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

receivers(self, signal)

removeEventFilter(self, a0)

reset_timer()

Restart timer with same delay.

schedule_update()

Start or restart the timer.

sender(self)

senderSignalIndex(self)

setObjectName(self, name)

setParent(self, a0)

setProperty(self, name, value)

set_delay(delay)

Set the debounce delay dynamically.

signalsBlocked(self)

startTimer(self, interval[, timerType])

stop()

Stop the timer if it's running.

thread(self)

timerEvent(self, a0)

tr(sourceText[, disambiguation, n])

destroyed

objectNameChanged

timeout

is_active()[source]#

Check if the timer is currently running.

reset_timer()[source]#

Restart timer with same delay.

schedule_update()[source]#

Start or restart the timer.

set_delay(delay)[source]#

Set the debounce delay dynamically.

Parameters:

delay (int) – Delay, by default 300

stop()[source]#

Stop the timer if it’s running.

timeout#

int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

Type:

str = …, revision

common.SearchTool module#

class common.SearchTool.SearchWidget(text_edit, parent=None, enable_replace=True, realtime=False)[source]#

Bases: QWidget

A search and replace toolbar for use with QTextEdit widgets.

Provides inline controls for real-time or return-triggered searching, case sensitivity, regex support, navigation through matches, and optional text replacement.

Parameters:
  • text_edit (QTextEdit) – The QTextEdit instance this widget will operate on.

  • parent (QWidget, optional) – Parent widget, by default None.

  • enable_replace (bool, optional) – If True, adds replacement input fields and buttons (default is True).

  • realtime (bool, optional) – If True, triggers search on every keypress; otherwise, search activates on Return (default is False).

Methods

acceptDrops(self)

accessibleDescription(self)

accessibleName(self)

actionEvent(self, a0)

actions(self)

activateWindow(self)

addAction(...)

addActions(self, actions)

adjustSize(self)

autoFillBackground(self)

backgroundRole(self)

baseSize(self)

blockSignals(self, b)

changeEvent(self, a0)

childAt(...)

childEvent(self, a0)

children(self)

childrenRect(self)

childrenRegion(self)

clearFocus(self)

clearMask(self)

clear_search()

Clears the search and replace fields, removes all highlights, and resets internal state (matches, positions, cursor).

close(self)

closeEvent(self, a0)

colorCount(self)

connectNotify(self, signal)

contentsMargins(self)

contentsRect(self)

contextMenuEvent(self, a0)

contextMenuPolicy(self)

create(self[, window, initializeWindow, ...])

createWindowContainer(window[, parent, flags])

cursor(self)

customEvent(self, a0)

deleteLater(self)

depth(self)

destroy(self[, destroyWindow, destroySubWindows])

devType(self)

devicePixelRatio(self)

devicePixelRatioF(self)

devicePixelRatioFScale()

disconnect(-> bool disconnect)

disconnectNotify(self, signal)

dragEnterEvent(self, a0)

dragLeaveEvent(self, a0)

dragMoveEvent(self, a0)

dropEvent(self, a0)

dumpObjectInfo(self)

dumpObjectTree(self)

dynamicPropertyNames(self)

effectiveWinId(self)

ensurePolished(self)

enterEvent(self, event)

event(self, a0)

eventFilter(self, a0, a1)

find(a0)

findChild(-> QObjectT)

findChildren(...)

focusInEvent(self, a0)

focusNextChild(self)

focusNextPrevChild(self, next)

focusOutEvent(self, a0)

focusPolicy(self)

focusPreviousChild(self)

focusProxy(self)

focusWidget(self)

font(self)

fontInfo(self)

fontMetrics(self)

foregroundRole(self)

frameGeometry(self)

frameSize(self)

geometry(self)

grab(self[, rectangle])

grabGesture(self, type[, flags])

grabKeyboard(self)

grabMouse(grabMouse)

grabShortcut(self, key[, context])

graphicsEffect(self)

graphicsProxyWidget(self)

hasFocus(self)

hasHeightForWidth(self)

hasMouseTracking(self)

hasTabletTracking(self)

height(self)

heightForWidth(self, a0)

heightMM(self)

hide(self)

hideEvent(self, a0)

highlight_matches()

Searches the text_edit for the current search term and highlights all matches.

inherits(self, classname)

initPainter(self, painter)

inputMethodEvent(self, a0)

inputMethodHints(self)

inputMethodQuery(self, a0)

insertAction(self, before, action)

insertActions(self, before, actions)

installEventFilter(self, a0)

isActiveWindow(self)

isAncestorOf(self, child)

isEnabled(self)

isEnabledTo(self, a0)

isFullScreen(self)

isHidden(self)

isLeftToRight(self)

isMaximized(self)

isMinimized(self)

isModal(self)

isQuickItemType(self)

isRightToLeft(self)

isSignalConnected(self, signal)

isVisible(self)

isVisibleTo(self, a0)

isWidgetType(self)

isWindow(self)

isWindowModified(self)

isWindowType(self)

keyPressEvent(self, a0)

keyReleaseEvent(self, a0)

keyboardGrabber()

killTimer(self, id)

layout(self)

layoutDirection(self)

leaveEvent(self, a0)

locale(self)

logicalDpiX(self)

logicalDpiY(self)

lower(self)

mapFrom(-> QPoint)

mapFromGlobal(-> QPoint)

mapFromParent(-> QPoint)

mapTo(-> QPoint)

mapToGlobal(-> QPoint)

mapToParent(-> QPoint)

mask(self)

maximumHeight(self)

maximumSize(self)

maximumWidth(self)

metaObject(self)

metric(self, a0)

minimumHeight(self)

minimumSize(self)

minimumSizeHint(self)

minimumWidth(self)

mouseDoubleClickEvent(self, a0)

mouseGrabber()

mouseMoveEvent(self, a0)

mousePressEvent(self, a0)

mouseReleaseEvent(self, a0)

move(move)

moveEvent(self, a0)

moveToThread(self, thread)

nativeEvent(self, eventType, message)

nativeParentWidget(self)

navigate_match([forward])

Navigates to the next or previous search match in the document.

nextInFocusChain(self)

normalGeometry(self)

objectName(self)

overrideWindowFlags(self, type)

overrideWindowState(self, state)

paintEngine(self)

paintEvent(self, a0)

paintingActive(self)

palette(self)

parent(self)

parentWidget(self)

physicalDpiX(self)

physicalDpiY(self)

pos(self)

previousInFocusChain(self)

property(self, name)

pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal.

raise_(self)

receivers(self, signal)

rect(self)

releaseKeyboard(self)

releaseMouse(self)

releaseShortcut(self, id)

removeAction(self, action)

removeEventFilter(self, a0)

render(, sourceRegion, flags, sourceRegion, ...)

repaint(...)

replace_all()

Replaces all matches in the document with the replacement text.

replace_current()

Replaces the currently selected match in the text_edit with the replacement text.

resize(resize)

resizeEvent(self, a0)

restoreGeometry(self, geometry)

saveGeometry(self)

screen(self)

scroll(scroll)

select_current(length)

Moves the cursor to the currently selected match and applies highlight.

sender(self)

senderSignalIndex(self)

setAcceptDrops(self, on)

setAccessibleDescription(self, description)

setAccessibleName(self, name)

setAttribute(self, attribute[, on])

setAutoFillBackground(self, enabled)

setBackgroundRole(self, a0)

setBaseSize(setBaseSize)

setContentsMargins(setContentsMargins)

setContextMenuPolicy(self, policy)

setCursor(self, a0)

setDisabled(self, a0)

setEnabled(self, a0)

setFixedHeight(self, h)

setFixedSize(setFixedSize)

setFixedWidth(self, w)

setFocus(setFocus)

setFocusPolicy(self, policy)

setFocusProxy(self, a0)

setFont(self, a0)

setForegroundRole(self, a0)

setGeometry(setGeometry)

setGraphicsEffect(self, effect)

setHidden(self, hidden)

setInputMethodHints(self, hints)

setLayout(self, a0)

setLayoutDirection(self, direction)

setLocale(self, locale)

setMask(setMask)

setMaximumHeight(self, maxh)

setMaximumSize(setMaximumSize)

setMaximumWidth(self, maxw)

setMinimumHeight(self, minh)

setMinimumSize(setMinimumSize)

setMinimumWidth(self, minw)

setMouseTracking(self, enable)

setObjectName(self, name)

setPalette(self, a0)

setParent(setParent)

setProperty(self, name, value)

setScreen(self, a0)

setShortcutAutoRepeat(self, id[, enabled])

setShortcutEnabled(self, id[, enabled])

setSizeIncrement(setSizeIncrement)

setSizePolicy(setSizePolicy)

setStatusTip(self, a0)

setStyle(self, a0)

setStyleSheet(self, styleSheet)

setTabOrder(a0, a1)

setTabletTracking(self, enable)

setToolTip(self, a0)

setToolTipDuration(self, msec)

setUpdatesEnabled(self, enable)

setVisible(self, visible)

setWhatsThis(self, a0)

setWindowFilePath(self, filePath)

setWindowFlag(self, a0[, on])

setWindowFlags(self, type)

setWindowIcon(self, icon)

setWindowIconText(self, a0)

setWindowModality(self, windowModality)

setWindowModified(self, a0)

setWindowOpacity(self, level)

setWindowRole(self, a0)

setWindowState(self, state)

setWindowTitle(self, a0)

sharedPainter(self)

show(self)

showEvent(self, a0)

showFullScreen(self)

showMaximized(self)

showMinimized(self)

showNormal(self)

signalsBlocked(self)

size(self)

sizeHint(self)

sizeIncrement(self)

sizePolicy(self)

stackUnder(self, a0)

startTimer(self, interval[, timerType])

statusTip(self)

style(self)

styleSheet(self)

tabletEvent(self, a0)

testAttribute(self, attribute)

thread(self)

timerEvent(self, a0)

toggle_replace_fields()

Shows or hides the replace input and buttons based on the toggle state.

toolTip(self)

toolTipDuration(self)

tr(sourceText[, disambiguation, n])

underMouse(self)

ungrabGesture(self, type)

unsetCursor(self)

unsetLayoutDirection(self)

unsetLocale(self)

update(update update update  -> None  -> None)

updateGeometry(self)

updateMicroFocus(self[, query])

update_match_label()

Updates the display label that shows current match index and total matches.

updatesEnabled(self)

visibleRegion(self)

whatsThis(self)

wheelEvent(self, a0)

width(self)

widthMM(self)

winId(self)

window(self)

windowFilePath(self)

windowFlags(self)

windowHandle(self)

windowIcon(self)

windowIconText(self)

windowModality(self)

windowOpacity(self)

windowRole(self)

windowState(self)

windowTitle(self)

windowType(self)

x(self)

y(self)

PaintDeviceMetric

RenderFlag

customContextMenuRequested

destroyed

objectNameChanged

windowIconChanged

windowIconTextChanged

windowTitleChanged

Clears the search and replace fields, removes all highlights, and resets internal state (matches, positions, cursor).

highlight_matches()[source]#

Searches the text_edit for the current search term and highlights all matches.

Handles both regex and plain text search with optional case sensitivity. Highlights all matches in yellow and the current match in cyan.

Updates the match counter label and prepares match positions for navigation.

navigate_match(forward=True)[source]#

Navigates to the next or previous search match in the document.

Parameters:

forward (bool, optional) – If True, goes to the next match; if False, goes to the previous (default is True).

replace_all()[source]#

Replaces all matches in the document with the replacement text.

Handles both regex and plain text replacement with optional case sensitivity. Validates regex patterns before execution and warns if invalid.

replace_current()[source]#

Replaces the currently selected match in the text_edit with the replacement text. After replacing, it re-highlights all matches to update positions.

select_current(length)[source]#

Moves the cursor to the currently selected match and applies highlight.

Parameters:

length (int) – The length of the matched text (used to create the cursor range).

toggle_replace_fields()[source]#

Shows or hides the replace input and buttons based on the toggle state.

update_match_label()[source]#

Updates the display label that shows current match index and total matches. e.g., ‘3 / 7’

common.SortAnalytes module#

common.SortAnalytes.sort_analytes(method, analytes, order='d')[source]#

Sort the analyte list

Sorting the analyte list can make data selection easier, or improve the pattern of correlations and PCA vectors.

Parameters:
  • method (str) – Method used for sorting. Options include 'alphabetical', 'atomic number', 'mass', 'compatibility', and 'radius'.

  • analytes (list) – List of analytes to sort

  • order (str, optional) – Sets order as ascending ('a') or decending ('d'), by default ‘d’

Returns:

Sorted analyte list.

Return type:

list

common.TableFunctions module#

class common.TableFunctions.TableFcn(parent=None)[source]#

Bases: object

Common table operations class

For moving and deleting rows in QTableWidgets

Methods

delete_row(table)

Deletes selected rows in a table

move_row_down(table)

Moves a row down one position in a table

move_row_up(table)

Moves a row up one position in a table

delete_row(table)[source]#

Deletes selected rows in a table

Parameters:

table (QTableWidget)

move_row_down(table)[source]#

Moves a row down one position in a table

Moves the selected row in a table down one position. If multiple are selected only the top row is moved.

Parameters:

table (QTableWidget)

move_row_up(table)[source]#

Moves a row up one position in a table

Moves the selected row in a table up one position. If multiple are selected only the top row is moved.

Parameters:

table (QTableWidget)

common.colorfunc module#

common.colorfunc.get_hex_color(color)[source]#

Converts QColor to hex-rgb format

Parameters:

color (list of int) – RGB color triplet

Returns:

hex code for an RGB color triplet

Return type:

str

common.colorfunc.get_rgb_color(color)[source]#

Convert from hex to RGB formatted color

Parameters:

color (str or list) – Converts a hex str to RGB colors. If list, should be a list of hex str.

Returns:

RGB color triplets used to create colormaps.

Return type:

list of int or list of RGB tuples

common.colorfunc.is_valid_hex_color(hex_str)[source]#

Validate if a string is a valid hex color in RGB (#RRGGBB) or RGBA (#RRGGBBAA) format.

Parameters:

hex_str (str) – The hex color string.

Returns:

True if valid, False otherwise.

Return type:

bool

common.colorfunc.qcolor_to_nrgb(colors)[source]#

Convert a list of QColor objects into a list of normalized (R, G, B) tuples.

Parameters:

colors (list of QColor)

Returns:

Each tuple is (r, g, b) with values in [0, 1].

Return type:

list of tuple

common.colorfunc.qcolor_to_rgb(colors)[source]#

Convert a list of QColor objects into a list of normalized (R, G, B) tuples.

Parameters:

colors (list of QColor)

Returns:

Each tuple is (r, g, b) with values in [0, 1].

Return type:

list of tuple

common.csvdict module#

common.csvdict.export_dict_to_csv(dictionary, filename)[source]#

Exports a dictionary to csv file

Explorts a simple dictionary that includes a set of keyword associated with lists to a csv. The first column are the dictionary keys and all subsequent columns are values associated with the key.

Parameters:
  • dictionary (dict) – Dictionary to save.

  • filename (str) – Name of file used to save dictionary. Include path in the filename.

Raises:

ValueError dictionary must be of type dict.

common.csvdict.export_filtered_dict_to_csv(dictionary, filename, filter_key, filter_val, selected_keys=None)[source]#

Exports specific items from a dictionary to a CSV file based on conditions.

Parameters:
  • dictionary (dict) – The dictionary to filter and export.

  • filename (str) – Name of file used to save dictionary. Include path in the filename.

  • filter_key (any) – Key used to filter dictionary

  • filter_val (any) – Value associated with key to select items to add to the csv

  • selected_keys (list, optional) – List of keys to include in the export, by default None

Raises:

ValueError dictionary must be of type dict.

common.csvdict.import_csv_to_dict(filename)[source]#

Imports a csv to a dictionary

Imports a csv in the format produced by MainWindow.export_dict_to_csv

Parameters:

filename (str) – File for import, include path name.

Returns:

Contents of filename as a dictionary.

Return type:

dict

common.format module#

common.format.dynamic_format(value, threshold=10000.0, order=4, toward=None)[source]#

Prepares number for display as str

Formats a number of display as a str, typically in a lineEdit widget.

Parameters:
  • value (float) – number to round

  • threshold (float, optional) – order of magnitude for determining display as floating point or expressing in engineering notation, by default 1e4

  • order (int, optional) – number of orders to keep, by default 4

  • toward (int, optional) – direction for rounding, 0 for down, 1 for up, and None for nearest, by default None

Returns:

number formatted as a string

Return type:

str

common.format.inv_logit(x)[source]#

Applies the inverse logit (sigmoid) transformation to a numpy array.

The inverse logit transforms the data from normal space to sigmoid space and is defined as,

\[\operatorname{logit}^{-1}(x) = [1 / (1 + e^{-x})]\]

This maps real-valued inputs back to the (0, 1) interval.

Parameters:

x (numpy.ndarray) – Input array of real values.

Returns:

  • numpy.ndarray – Transformed array with values between 0 and 1.

  • see also: logit

common.format.inv_symlog(x, linthresh=1.0)[source]#

Inverse symlog transform back to linear space.

Converts a symlog array back to into linear space,

\[\operatorname{symlog}^{-1}(x) = \operatorname{sign} (x) \lambda (10^{|x|} - 1)\]

where \(\lambda\) is the linear threshold used to control the region near zero where the data behave linearly.

Parameters:
  • x (numpy.ndarray) – the array of values to transform

  • linear_threshold (float, optional) – linear threshold, often chosen as the mean, median, or standard deviation of the data or simply, by default 1.0

Returns:

  • numpy.ndarray – transformed values of x back to linear space

  • see also: symlog

common.format.logit(x, eps=1e-08)[source]#

Applies the logit (log-odds) transformation to a numpy array.

The logit function is defined as,

\[\operatorname{logit}(x) = \log [x / (1 - x)]\]

Values of x must be in the open interval (0, 1). To avoid division by zero or log of zero, values are clipped to [eps, 1 - eps].

Parameters:
  • x (numpy.ndarray) – Input array with values between 0 and 1.

  • eps (float, optional) – Small value used to clip inputs away from 0 and 1 to prevent numerical issues. Default is 1e-8.

Returns:

  • numpy.ndarray – Transformed array with log-odds values.

  • see also: inv_logit

common.format.oround(val, order=2, toward=None)[source]#

Rounds a single of value to n digits

Round a single number to the first n digits.

Parameters:
  • val (float) – number to round

  • order (int, optional) – number of orders to retain, by default 2

  • toward (int, optional) – direction for rounding, 0 for down, 1 for up, and None for nearest, by default None

Returns:

rounded matrix values

Return type:

float

common.format.oround_matrix(val, order=2, toward=None)[source]#

Rounds a matrix of values to n digits

Rounds all numbers in a matrix to the first n digits.

Parameters:
  • val (float) – number to round

  • order (int, optional) – number of orders to retain, by default 2

  • toward (int, optional) – direction for rounding, 0 for down, 1 for up, and None for nearest, by default None

Returns:

rounded matrix values

Return type:

float

common.format.parse_isotope(field: str)[source]#

Converts an isotope into a symbol and mass.

Separates an analyte field with a symbol-mass name to its separate parts. For example, 27Al returns Al (symbol), 27 (mass).

Parameters:

field (str) – Field name to separate into symbol and mass.

Returns:

  • symbol (str) – Returns the element symbol.

  • mass (int) – Returns the isotope mass.

common.format.symlog(x, linear_threshold=1.0)[source]#

Transforms data from linear to symlog space

The advantage of a symlog transformation is that produces a log-like distribution for most values, but can be used on negative and zero values as well as positive values, preserves symmetry about 0.

A symlog transformation is

\[\operatorname{symlog} (x) = \operatorname{sign} (x) \log_{10} (1 + |x|/\lambda),\]

where \(\lambda\) is the linear threshold, region where the transformation is approximately linear.

Parameters:
  • x (numpy.ndarray) – the array of values to transform

  • linear_threshold (float, optional) – linear threshold, often chosen as the mean, median, or standard deviation of the data or simply, by default 1.0

Returns:

transformed values of x into symlog space

Return type:

numpy.ndarray

common.gausscensor module#

common.gausscensor.gausscensor(x, scale='linear', q=[0.05, 0.25, 0.5, 0.75, 0.95], a=0.375)[source]#

Estimates statistical parameters when there are censored data.

Estimates the mean, and standard deviation when there are censored data. This method is specifically for use with compositional data that should be positive only. Values of zero indicate a left censored value, but no detection limit has been reported. Negative values indicate left censored values with absolute value being the detection limit.

Reference: Michael, J.R., and W.R. Schucany, 1986, Analysis of Data from Censored Samples, in Goodness-of-Fit-Techniques, eISBN: 9780203753064

Parameters:
  • x (numpy.ndarray) – Array of data with left-censored values, zero indicates unknown detection limit, absolute value of negative value indicates known detection limit.

  • scale (str, optional) – Options include linear, log and log10, by default ‘linear’

  • q (list, optional) – A list of percentiles to estimate the quantile, by default [0.05, 0.25, 0.5, 0.75, 0.95]

  • a (shape parameter, optional) – Determined by the type of distribution, by default 3/8

Returns:

Returns a dictionary with statistical estimates for scale parameters (mu and sigma) and uncertainty of the mean (sigma_mu) and an estimated root-mean-square (rms) misfit.

Return type:

dict, list

common.outliers module#

common.outliers.chauvenet_criterion(array, threshold=1)[source]#

Apply Chauvenet’s criterion for outlier detection.

Parameters:
  • array (numpy.ndarray) – The dataset to analyze.

  • threshold (float) – The probability threshold multiplier for rejecting outliers (default is 1, stricter is higher).

Returns:

Boolean mask, with outliers identified as false.

Return type:

numpy.ndarray

Source: https://en.wikipedia.org/wiki/Chauvenet%27s_criterion

common.outliers.peirce_dev(N, n, m) float[source]#

Peirce’s criterion

Returns the squared threshold error deviation for outlier identification using Peirce’s criterion based on Gould’s methodology.

Parameters:
  • N (int) – Total number of observations

  • n (int) – number of outliers to be removed

  • m (int) – number of model unknowns

Returns:

  • float – squared error threshold

  • Source (Wikipedia https://en.wikipedia.org/wiki/Peirce%27s_criterion)

common.outliers.quantile_and_difference(array, pl, pu, dpl, dpu, compositional, max_val)[source]#

Outlier detection with cluster-based correction for negatives and compositional constraints, using percentile-based shifting.

Parameters:
  • array (numpy.ndarray) – Data to detect outliers

  • pl (float) – lower percentile bound

  • pu (float) – upper percentile bound

  • dpl (float) – _description_

  • dpu (float) – _description_

  • compositional (bool) – _description_

  • max_val (float) – _description_

Returns:

array with outliers removed

Return type:

numpy.ndarray

common.plot_spider module#

Created on Wed Nov 22 16:56:39 2023

@author: Shavin Kaluthantri

common.plot_spider.fillinterval(ax, x, y, color, alpha)[source]#
common.plot_spider.logax(ax, lim, axis='y', label='', tick_label_rotation=0)[source]#

Produces log-axes limits and labels.

Parameters: ax (matplotlib.axes.Axes): The axes to modify. lim (list): The log10 values of the axes limits. axis (str): ‘x’ or ‘y’ to add ticks to x- or y-axis, default is ‘y’. label (str): Label for the axis. tick_label_rotation (float): Angle of text rotation, default is 0.

common.plot_spider.ox2ppm(element_list, data)[source]#
common.plot_spider.plot_data(ax, t, C, style, el_list, Q=None, label=None)[source]#
common.plot_spider.plot_spider_norm(data, ref_data, norm_ref_data, layer, el_list=None, style='Quanta', quantiles=[0.25, 0.5, 0.75], ax=None, c='b', label=None)[source]#

common.radar module#

class common.radar.Radar(ax, data, fields, fieldlabels=None, group_field='', groups=None, quantiles=None, axes_interval=5)[source]#

Bases: object

Prepares a DataFrame for a radar plot.

_extended_summary_

Parameters:
  • ax (matplotlib.axes) – Axis object

  • data (pandas.DataFrame) – Data used for averaging.

  • fields (list) – list of fields in data used to define the axes.

  • fieldlabels (list) – Labels associated with fields. If None, fieldlabels is set to fields, by default None

  • group_field (str, optional) – _description_, by default ‘’

  • groups (_type_, optional) – _description_, by default None

  • quantiles (_type_, optional) – _description_, by default None

  • axes_interval (int, optional) – _description_, by default 5

Raises:

ValueError – _description_

Methods

normalize_vals()

Normalizes the data in self.vals for radar plot visualization.

plot([cmap])

_summary_

normalize_vals()[source]#

Normalizes the data in self.vals for radar plot visualization.

plot(cmap=None)[source]#

_summary_

_extended_summary_

Parameters:

cmap (matplotlib.colormap, optional) – colormap, by default None

common.radar_factory module#

common.radar_factory.radar_factory(num_vars, frame='polygon')[source]#

Create a radar chart with num_vars axes.

Parameters:

num_vars – number of variables for radar chart

… :raises [ErrorType]: [ErrorDescription] … :return: [ReturnDescription] :rtype: [ReturnType]

common.rotated module#

common.scalebar module#

class common.scalebar.scalebar(width, pixel_width, units=None, location='southeast', orientation='horizontal', color=[0, 0, 0], ax=None)[source]#

Bases: object

Produces a scalebar on x,y maps

Produce a scalebar on (x,y) maps, just inside one corner of the map.

create : Add scalebar to axes
Parameters:
  • width (float) – Absolute width of the scalebar in units

  • pixel_width (float) – Pixel dimensions in the orientation direction. Since matplotlib.pyplot.imshow does not allow for x, y values, the pixel_width is important for converting between absolute units and image units.

  • units (str, optional) – Units to include on plot e.g., ‘mm’, by default None

  • location (str, optional) – Scalebar location, defined by corner. Options include 'northeast', 'northwest', 'southeast', and 'southwest', by default 'southeast'

  • orientation (str, optional) – Scalebar orientation, either 'horizontal' or 'vertical', by default 'horizontal'

  • color (list, optional) – Color of scalebar in matplotlib color spec., by default [0, 0, 0]

  • ax (matplotlib.axes, optional) – Axis to add scalebar onto, by default None

Raises:
  • ValueError – ‘Unknown location, choose from [northeast, northwest, southwest, southeast].’

  • ValueError – ‘Unknown location, choose from [horizontal, vertical].’

Methods

create()

_summary_

create()[source]#

_summary_

_extended_summary_

common.ternary_colormap module#

common.ternary_plot module#

Created on Thu Nov 2 20:43:59 2023

@author: Shavin Kaluthantri and Derrick Hasterok

class common.ternary_plot.ternary(ax, labels=None, plot_type='scatter', style='ternary', grid_spacing=None, tick_spacing=None)[source]#

Bases: object

Ternary plotting class, produces ternary axes and creates various plot types.

The ternary plotting class can be used to produce scatter plots, heatmaps, or produce ternary coloring maps that can be used to color points

Parameters:
  • ax (matplotlib.axes) – Axes object for displaying ternary diagram

  • labels (list of str) – Vertex labels

  • plot_type (str, optional) – Defaults to ‘scatter’

  • style (str, optional) – Ternary plot style, ternary (triangle) or quaternary (diamond)

  • grid_spacing (float, optional) – grid spacing (0,1), Defaults to None

  • tick_spacing (float, optional) – tick spacing (0,1), Defaults to None

Raises:
  • ValueError – ‘Bins must be a positive integer’, requires bin values are positive.

  • ValueError – ‘Number of vertices must be 3 or 4’, 3 verticies are required for ternary diagram and 4 for quaternary (double ternary).

  • ValueError – ‘Tick spacing must be between 0 and 1’

  • ValueError – “Style must be ‘ternary’ or ‘quaternary’”

Methods

cplane(a, b, c, ca, cb, cc, p, cp)

Determines colors for a set of points (a,b,c) within a ternary

cplanexy(xd, yd, xp, yp, cp, x1, y1, cv1, ...)

Fits a plane to (x,y,color) data

hexagon(bins)

Creates hexagonal bins within a ternary

tern2xy(a, b, c)

Converts ternary (a,b,c) points to cartesian (x,y) coordinates.

ternaxes([labels])

Set up ternary plot axes with optional labeling for a quaternary plot.

terncolor(a, b, c[, ca, cb, cc, p, cp])

Computes colors using a ternary colormap

terngrid([spacing])

Adds ternary grid lines to ternary axes.

ternhex([a, b, c, val, hexbin_df, ...])

Creates a heatmap from a set of hexgonal bins

ternscatter(a, b, c[, d, size, cmap, color, ...])

Scatter plot data on ternary axes.

ternticks([spacing])

Adds ternary tick marks to ternary axes.

xy2tern(x, y)

Converts cartesian (x,y) points to ternary (a,b,c) coordinates.

cplane(a, b, c, ca, cb, cc, p, cp)[source]#

Determines colors for a set of points (a,b,c) within a ternary

Given four colors, one for each vertex of a ternary and a fourth at an arbitrary location within the triangle, the function computes a gradient for any set of points within the triangle.

Parameters:
  • a (np.array) – Ternary coordinates of data points where color is computed

  • b (np.array) – Ternary coordinates of data points where color is computed

  • c (np.array) – Ternary coordinates of data points where color is computed

  • ca (np.array) – Colors set at verticies

  • cb (np.array) – Colors set at verticies

  • cc (np.array) – Colors set at verticies

  • p (np.array) – Location of interior point where an additional color can be defined (i.e., cp)

  • cp (np.array) – Color at p, default is [], which will use average of colors

Returns:

cval, colors at (a,b,c)

Return type:

np.array

cplanexy(xd, yd, xp, yp, cp, x1, y1, cv1, x2, y2, cv2)[source]#

Fits a plane to (x,y,color) data

Fits a plane using three points in (x,y,color) space and then interpolates the color of know points.

Parameters:
  • xd (np.array) – Cartesian coordinates for data within ternary

  • yd (np.array) – Cartesian coordinates for data within ternary

  • xp (float) – Coordinates of point within ternary

  • yp (float) – Coordinates of point within ternary

  • cp (np.array) – color at point within ternary

  • x1 (float) – Coordinates at ternary vertex 1

  • y1 (float) – Coordinates at ternary vertex 1

  • cv1 (np.array) – Color at vertex 1

  • x2 (float) – Coordinates at ternary vertex 2

  • y2 (float) – Coordinates at ternary vertex 2

  • cv2 (np.array) – Color at vertex 2

Returns:

cval, colors at (a,b,c)

Return type:

np.array

hexagon(bins)[source]#

Creates hexagonal bins within a ternary

Parameters:

n (int) – Hexagonal cell resolution, equivalent to n+1 cells across the bottom, values must be >0.

Returns:

hexbin, Dictionary of hexagonal bins, including verticies, in Cartesian coordinates and the center of each cell

Return type:

dict

tern2xy(a, b, c)[source]#

Converts ternary (a,b,c) points to cartesian (x,y) coordinates.

The order of the axes are a (top), b (left), and c (right), where the Cartesian origin is defined at the midpoint between b and c.

Parameters:
  • a (np.array) – Top, left and right vertex coordinates, respectively

  • b (np.array) – Top, left and right vertex coordinates, respectively

  • c (np.array) – Top, left and right vertex coordinates, respectively

ternaxes(labels=None)[source]#

Set up ternary plot axes with optional labeling for a quaternary plot.

Parameters:

labels (list of str, optional) – List of strings for the labels of the axes, by default None.

terncolor(a, b, c, ca=[1, 1, 0], cb=[0.3, 0.73, 0.1], cc=[0, 0, 0.15], p=[0.3333333333333333, 0.3333333333333333, 0.3333333333333333], cp=[])[source]#

Computes colors using a ternary colormap

Given four colors, one for each vertex of a ternary and a fourth at an arbitrary location within the triangle, the function computes a gradient for any set of points within the triangle. Default color scheme is yellow-green-navy.

a, b, cnp.array

Ternary coordinates of data points where color is to be computed

ca, cb, ccnp.array, optional

Colors set at verticies, by defaults ca=[0.3,0.73,0.1], cb=[0,0,0.15], cc=[1/3,1/3,1/3]

pnp.array, optional

Location of interior point where an additional color can be defined (i.e., cp)

cpnp.array, optional

Color at p, default is [], which will use average of colors

Returns:

cval, colors at (a,b,c)

Return type:

np.array

terngrid(spacing=0.1)[source]#

Adds ternary grid lines to ternary axes.

Updates current ternary axes with tick marks.

Parameters:
  • spacing (float) – Grid spacing. Values must be on the interval (0,1), by default 0.1

  • nvertices (int) – Number of vertices, either 3 or 4. A value of 3 produces a ternary grid and a value of 4 produces a quaternary grid.

ternhex(a=None, b=None, c=None, val=None, hexbin_df=None, plotfield=None, bins=10, cmap=None, orientation='horizontal', norm=None)[source]#

Creates a heatmap from a set of hexgonal bins

Parameters:
  • a (np.array, optional) – Locations of points within a ternary system, not needed if hexbin_df is provided, by default None

  • b (np.array, optional) – Locations of points within a ternary system, not needed if hexbin_df is provided, by default None

  • c (np.array, optional) – Locations of points within a ternary system, not needed if hexbin_df is provided, by default None

  • val (np.array, optional) – A fourth-dimension, compute statistics of val within each hexbin, not supplied if hexbin_df is provided, by default None

  • hexbin_df (pandas.DataFrame, optional) – A data frame containing statistics from a previously call to ternhex, in this case, do not supply a, b, c, or val, by default None

  • plotfield (str, optional) – Field in hexbin_df to plot, values may include [‘n’, ‘mean’, ‘median’, ‘std’]. If None, no plot is produced, but hexbin_df is returned, by defaults None

  • bins (int, optional) – Resolution factor (bins+1 hexagons across bottom axis), by default 10

  • cmap (matplotlib.colors.Colormap) – colormap, by defaults None

  • norm (matplotlib.colors.Norm, optional) – Normalize colormap

  • orientation (str, optional) – orientation of colormap, horizontal or vertical, by default horizontal

ternscatter(a, b, c, d=None, size=36, cmap=None, color=None, categories=None, labels=False, alpha=1, marker='o', edgecolors='none', ax=None, orientation='horizontal', norm=None)[source]#

Scatter plot data on ternary axes.

Ternary scatter plot, ternscatter() uses many of the same parameters as matplotlib scatter.

Parameters:
  • a (np.array) – Coordinate associated with top, left and right vertices, respectively

  • b (np.array) – Coordinate associated with top, left and right vertices, respectively

  • c (np.array) – Coordinate associated with top, left and right vertices, respectively

  • d (np.array, optional) – Coordinate associated with bottom vertex of quaternary (diamond) plot, by default None

  • size (float, optional) – Marker size (in points), by defaults 36

  • cmap (matplotlib.Colormap, optional) – Colormap if points are to be colored by value, by defaults None

  • color (optional) – Color of markers, defaults to None

  • norm (matplotlib.colors.norm) – Normalize colormap

  • edgecolors (optional) – By default None

  • marker (str, optional) – Symbol used for plotting, Defaults to ‘o’

  • categories (optional) – Values used to determine color for plotting. If categries is a set of discrete categories, add labels=True to display a legend with values for labels, by default None

  • labels (bool, optional) – Indicates categories are lables

Returns:

Scatter plot object, legend (if applicable)

Return type:

matplotlib.scatter_object

ternticks(spacing=0.1)[source]#

Adds ternary tick marks to ternary axes.

Updates current ternary axes with tick marks.

Parameters:

spacing (float) – Distance between tick marks.

xy2tern(x, y)[source]#

Converts cartesian (x,y) points to ternary (a,b,c) coordinates.

The order of the axes are a (top), b (left), and c (right), where the Cartesian origin is defined at the midpoint between b and c.

Parameters:
  • x (np.array) – Cartesian, x and y coordinates

  • y (np.array) – Cartesian, x and y coordinates

common.varfunc module#

class common.varfunc.ObservableDict(*args, callback=None, **kwargs)[source]#

Bases: dict

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

update([E, ]**F) None.  Update D from dict/iterable E and F.[source]#

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

common.varfunc.partial_match(array: list[str], string: str) list[bool][source]#

Checks whether values in a list partially match a string

Parameters:
  • array (list[str]) – List of partial strings to find in string

  • string (str) – Text to test.

Returns:

True for strings that match the input string.

Return type:

list[bool]

Module contents#